2

I'm looking for alternative ways of solving a problem. We're using ElFinder for browsing files, and we want to allow the user to change the access rights to a file element through the right-click context menu ("Change permissions"). The solution I have come up with so far is to load a server side ASP.NET usercontrol in a jQuery modal dialog window. This user control will contain the logic needed to add / remove user access to the selected element.

The jQuery Dialog script looks like this (slightly changed for readability), where DisplayItemAccessConfig() is the method that's called from the context menu:

<!-- access control script -->
<script type="text/javascript" charset="utf-8">

     function DisplayItemAccessConfig() {
        $.getJSON('AccessRights.ashx', function (data) {

            var itemName = data["itemName"];

            /* set new title (JUST FOR TESTING) */
            $(dialog).dialog('option', 'title', itemName);

            /* open modal dialog --> */
            $(dialog).dialog('open');

        });

    }

    $(function () {
        $("#dialog").dialog({
            autoOpen: false,
            modal: true,
            buttons: {
                "Ok": function () { $(this).dialog("close"); },
                "Cancel": function () { $(this).dialog("close"); }
            },
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });
    });    
</script>

Challenge 1: find a way to reload the user control each time the jQuery popup is displayed - this is to retrieve the current access settings for the selected element. Now it loads when the page is first loaded, since it's just a div element containing an update panel with a placeholder for my usercontrol and visibility set to none. Anyone have any tips here?

Challenge 2: While I am trying to figure that one out I thought it could be worth while asking for other opinions. Is there a better way of solving this? Should I use a pure jQuery with HTML and call server side .ashx methods to retrieve data, instead of an ASP.NET usercontrol?

1 Answer 1

1
  1. You can do this by creating a hidden button on inside the uploadpanel and then trigger it like this:

    __doPostBack('<%= Button.ClientID %>','');

  2. Personally I would drop the UpdatePanel and go for jQuery AJAX calls to update the content of the dialog window, but this depends on the complexity of your user control. Hard to say without seeing more of your code.

Sign up to request clarification or add additional context in comments.

1 Comment

I agree, a combination of jQuery AJAX and Knockoutjs should give me all the functionality I need without the update panels and partial postbacks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.