我是dotnetnuke模块开发的新手 .
设置:dotnetnuke 7 christoc模块,telerik ajax ui conrols:Q2发布2.我在DNN注册了一个usercontrol Patientupdate.ascx . 在其中我有几个控件,即radgrid(ResultaatGrid)和radwindow,也作为用户控件(但未在DNN中注册)命名为COVUserControl . 单击按钮时,以编码模式在radgrid内部调用radwindow .
radwindow的代码片段(在patientupdate.ascx中)
在radwindow中我放了usercontrol(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_Item命令中,我有以下代码:
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没有弹出窗口 . (我已检查主机中的弹出窗口 - > extension->并检查模块的允许弹出窗口) .
调试(附加)时,我看到Covgrid.rebind被触发,因为它触发了COVUserControl中网格的radgrid需要数据源 .
当不是dotnetnuke模块时,相同的代码工作,radwindow弹出窗口 . (只是简单的patientupdate.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);
2 回答
尝试
从用户控件或自定义控件注册脚本时遇到了一些问题 . 到目前为止,通过Page对象注册它们并没有让我失望 .
我和DNN的RADwindow一样走了同样的路线,简短的回答是在DNN时不使用
Sys.Application.add_load
,它完全不喜欢它 . 与组件的关系不是通过Sys.Application.add_init()加载的 .请改用
pageLoad()
.