【问题标题】:radwindow does not show in dotnetnukeradwindow 在 dotnetnuke 中不显示
【发布时间】:2014-10-29 14:06:07
【问题描述】:

我是 dotnetnuke 模块开发的新手。

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

radwindow 代码的 sn-p(在 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_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 没有弹出。 (我已经检查了 host -> 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);

【问题讨论】:

    标签: asp.net telerik dotnetnuke radwindow registerstartupscript


    【解决方案1】:

    试试

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

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 我尝试了以下代码但没有成功:-( function GetCOVWindow() { var wnd = $find(""); wnd.open(); }在后面的代码中: string script = "$(document).ready(function() { GetCOVWindow();});"; ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
      • $find 是 Microsoft AJAX 库定义的 Sys.Application 类的 findComponent 方法的快捷方式,因此它可以找到一个不是 html DOM 的组件,它可能还没有准备好
      • 我的建议是首先在 ascx 中进行这项工作,制作一些按钮并尝试打开 radwindow onclientclick,如果可以将其移至代码隐藏。
      • Sys.Application.Load 之前的事件不能保证您将拥有由 MS AJAX 创建的 Sys.Component 对象。
      • 我昨晚可能误读了一些东西。我建议编辑您的帖子,而不是添加后续的 cmets。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-26
      • 1970-01-01
      • 2018-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多