2014-10-29 53 views
0

我是新的dotnetnuke模块开发。radwindow不显示在dotnetnuke

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

为radwindow(所述patientupdate.ascx内部)

在我已经把用户控件(COVUserControl)的radwindow和我已经定义了一个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需要数据源。

相同的代码工作,radwindow弹出,当不是一个dotnetnuke模块。 (只是简单的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); 

回答

0

我正想相同的路线,你在DNN的radwindow和简单的答案是不使用Sys.Application.add_load在DNN时,根本不喜欢它。与组件通过Sys.Application.add_init()没有加载。
改为pageLoad()

+0

我尝试follwing码,但没有成功:-( 功能GetCOVWindow(){ \t变种WND = $找到( “<%= COVWindow.ClientID%>”); \t wnd.open(); } 在代码后面: string script =“$(document).ready(function(){GetCOVWindow();});”; ScriptManager.RegisterStartupScript(this,this.GetType(),“key”,script, true); – Henk 2014-11-03 11:50:03

+1

我不认为$ find可以从$(document).ready – tatigo 2014-11-03 16:35:25

+0

$ find工作。find是由Microsoft AJAX Library定义的Sys.Application类的findComponent方法的一个快捷方式,因此它可以找到一个组件不是HTML DOM,它可能还没有准备好 – tatigo 2014-11-03 16:36:27

0

尝试

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

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