0

我是 dotnetnuke 模块开发的新手。

设置:dotnetnuke 7 + christoc 模块,telerik ajax ui conrols:Q2 release 2。我在 DNN 中注册了一个 usercontrol Patientupdate.ascx。在它里面我有几个控件,即一个radgrid (ResultaatGrid) 和一个radwindow,也作为一个名为COVUserControl 的用户控件(但未在DNN 中注册)。当单击按钮时,radwindow 在formedit 模式下在radgrid 内被调用。

radwindow 的代码片段(在 patientupdate.ascx 内)

在 radwindow 中,我放置了用户控件 (COVUserControl),并在用户控件中定义了一个 radgrid。

<telerik:RadWindow ID="COVWindow" Title="Editing record" Width="270"
        Height="540" VisibleOnPageLoad="false" Behaviors="Resize, Minimize, Close, Pin, Maximize, Move"
        Left="610" EnableShadow="true" runat="server" OnClientClose="refreshGrid" Modal="true">
    <ContentTemplate>
         <asp:Panel ID="Panel1" runat="server">
                <COVUC:COVUserControl runat="server" ID="COVUCID"/>
        </asp:Panel>
    </ContentTemplate>
</telerik:RadWindow>

在编辑模板中,我有一个名为(在 patientupdate.ascx 中)的按钮,并且在 patientupdate.ascx.cs 后面的代码中

在 ResultaatGrid_Itemcommand 我有以下代码:

     protected void ResultaatGrid_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "COV")
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;

            string pCperID = editedItem.GetDataKeyValue("cpersoon_id").ToString();
            COVWindow.Width = 500;
            COVWindow.Height = 250;
            COVUserControl COVUC1 = COVWindow.ContentContainer.FindControl("COVUCID") as COVUserControl;
            COVUC1.cPersoonID = pCperID;
            RadGrid COVGrid = COVUC1.FindControl("COVGrid") as RadGrid;
            string script = "function f(){$find(\"" + COVWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
            COVGrid.Rebind();
        }

    }

问题是 radwindow 没有弹出。(我已经检查了主机-> 扩展-> 中的弹出窗口并检查了模块的允许弹出窗口)。

调试(附加)时,我看到 Covgrid.rebind 被触发,因为它触发了 COVUserControl 内网格的 radgrid 需要数据源。

当不是 dotnetnuke 模块时,相同的代码可以工作,即 radwindow 弹出窗口。(只是普通的耐心更新.aspx)。

我认为以下代码行不会触发:

string script = "function f(){$find(\"" + COVWindow.ClientID + "\").show();     
Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
4

2 回答 2

0

尝试

ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", script, true);

从用户控件或自定义控件注册脚本时,我遇到了一些问题。到目前为止,通过 Page 对象注册它们并没有让我失望。

于 2014-11-04T14:08:05.183 回答
0

我和你在 DNN 中使用 radwindow 的路线相同,简短的回答是不要Sys.Application.add_load在 DNN 中使用,它根本不喜欢它。与未通过 Sys.Application.add_init() 加载的组件有关。
去吧pageLoad()

于 2014-11-03T03:32:45.753 回答