2

我正在寻找解决问题的替代方法。我们正在使用ElFinder浏览文件,并且我们希望允许用户通过右键单击上下文菜单(“更改权限”)更改对文件元素的访问权限。到目前为止,我提出的解决方案是在 jQuery 模式对话框窗口中加载服务器端 ASP.NET 用户控件。此用户控件将包含添加/删除对选定元素的用户访问权限所需的逻辑。

jQuery Dialog 脚本看起来像这样(为了便于阅读,稍作更改),其中 DisplayItemAccessConfig() 是从上下文菜单调用的方法:

<!-- 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?

4

1 回答 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. 就我个人而言,我会放弃 UpdatePanel 并使用 jQuery AJAX 调用来更新对话框窗口的内容,但这取决于用户控件的复杂性。很难说没有看到更多的代码。

于 2012-04-12T06:29:48.297 回答