如何从代码隐藏运行 telerik RadWindow

发布于 2024-12-23 06:36:04 字数 532 浏览 3 评论 0原文

我正在尝试从代码后面运行 telerik rad 窗口。但我有一些问题。 我不知道这是否重要,但我正在尝试从 rad 网格的编辑模式下单击的按钮运行 rad 窗口。

RadWindow window1 = new RadWindow();
window1.NavigateUrl = "http://www.google.com";
window1.VisibleOnPageLoad = true;
window1.ID = "RadWindow1";
window1.Width = 500;
window1.Height = 300;
window1.VisibleOnPageLoad = true;    
rwm_WindowManager.Windows.Add(window1);

在页面上,我还有放入 RadAjaxPanel 中的 RadAjaxManagerrwm_WindowManager
问题是这个 rad 窗口永远不会出现。没有错误,但也没有 rad 窗口。

I am trying to run telerik rad window from code behind. But I have some issues.
I don't know is it important but I am trying to run rad window from button clicked in edit mode from rad grid.

RadWindow window1 = new RadWindow();
window1.NavigateUrl = "http://www.google.com";
window1.VisibleOnPageLoad = true;
window1.ID = "RadWindow1";
window1.Width = 500;
window1.Height = 300;
window1.VisibleOnPageLoad = true;    
rwm_WindowManager.Windows.Add(window1);

On the page I also have RadAjaxManager and rwm_WindowManager I put in RadAjaxPanel.
Problem is that this rad window never shows up. There are no errors but no rad window also.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

放飞的风筝 2024-12-30 06:36:04
 <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
            OnItemCommand="RadGrid1_ItemCommand">
            <MasterTableView DataKeyNames="ID">
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Button ID="Button1" Text="Open window" CommandName="OpenWindow" runat="server" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>

........................

 protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    dynamic data = new[] {
            new { ID = "1", Name ="Name11",ParentID = "0"},
            new { ID = "2", Name ="Name11",ParentID = "0"},
            new { ID = "3", Name ="Name11",ParentID = "0"},
            new { ID = "4", Name ="Name11",ParentID = "0"}
        };
    RadGrid1.DataSource = data;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "OpenWindow")
    {
        //RadWindowManager
        RadWindow window1 = new RadWindow();
        window1.NavigateUrl = "http://www.google.com";
        window1.VisibleOnPageLoad = true;
        window1.ID = "RadWindow1";
        window1.Width = 500;
        window1.Height = 300;
        RadWindowManager1.Windows.Add(window1);

    }
}

将 RadWindowManager 放入 RadAjaxPanel 中。

 <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
            OnItemCommand="RadGrid1_ItemCommand">
            <MasterTableView DataKeyNames="ID">
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Button ID="Button1" Text="Open window" CommandName="OpenWindow" runat="server" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>

........................

 protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    dynamic data = new[] {
            new { ID = "1", Name ="Name11",ParentID = "0"},
            new { ID = "2", Name ="Name11",ParentID = "0"},
            new { ID = "3", Name ="Name11",ParentID = "0"},
            new { ID = "4", Name ="Name11",ParentID = "0"}
        };
    RadGrid1.DataSource = data;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "OpenWindow")
    {
        //RadWindowManager
        RadWindow window1 = new RadWindow();
        window1.NavigateUrl = "http://www.google.com";
        window1.VisibleOnPageLoad = true;
        window1.ID = "RadWindow1";
        window1.Width = 500;
        window1.Height = 300;
        RadWindowManager1.Windows.Add(window1);

    }
}

put your RadWindowManager inside RadAjaxPanel.

时光沙漏 2024-12-30 06:36:04

我刚刚遇到了类似的问题。我这样解决了它:

RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(String.Format("$find('{0}').show();", window1.ClientID));

我的应用程序使用 RadAjax,这使得 VisibleOnPageLoad 属性出现问题,所以我完全避免它。

I just had a similar issue. I resolved it like so:

RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(String.Format("$find('{0}').show();", window1.ClientID));

My applications use RadAjax which makes the VisibleOnPageLoad property problematic, so I avoid it altogether.

鸠书 2024-12-30 06:36:04

看一下这里:如何刷新父页面关闭 radwindow 时网格? 并检查我的答案中的链接。这种方法更加简洁,并且可以避免一些不必要的回发。

Take a look here: How to refresh parent page grid when close radwindow? and examine the links from my answer. The approach is much cleaner and will spare you a couple of unnecessary postbacks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文