3

我的代码:

<asp:ImageButton ID="btnAddReport" runat="server" OnClientClick="return AddFavoritePopup()"
ImageUrl="~/Content/images/add_favorite.jpg" Width="24px" Height="20px" 
style="vertical-align:middle"/>

    function AddFavoritePopup() {
    var radWindow = document.getElementById('AddFavoriteRadWindow');
    radWindow.show()
    }

      <telerik:RadWindowManager runat="server" ID="RadWindowManager2" Title="Add Favorite"
            Behaviors="Close" VisibleStatusbar="False" Modal="False">
            <Windows>
                <telerik:RadWindow ID="AddFavoriteRadWindow" Width="500" Height="300" VisibleOnPageLoad="false" CssClass="radwindow" runat="server">
                    <ContentTemplate>
                        <table>
                            <tr>
                                <asp:Label ID="lblFavorite" runat="server" Text="Favorites: "></asp:Label>
                                <asp:TextBox ID="txtReportFavorite" runat="server"></asp:TextBox>
                            </tr>
                            <tr>
                                <asp:Button ID="btnOk" runat="server" Text="OK" Width="50" Height="25" onclick="btnOk_Click" />
                                <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="50" Height="25" onclick="btnCancel_Click" />
                            </tr>
                        </table>
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>

如何在脚本中打开 RadWindow。我尝试了显示功能。它没有打开。谢谢。

4

2 回答 2

2

try this

  var oWnd = $find("<%=AddFavoriteRadWindow.ClientID%>");
    oWnd.show();

or alternate

    var oManager = GetRadWindowManager();       
    oManager.open(null, "AddFavoriteRadWindow"); 
于 2012-10-15T10:49:39.483 回答
1

该窗口不会出现,因为在执行代码时,尚未完全呈现页面上的所有控件。

您可以做些什么来避免这种情况,即使用Sys.Application.add_load函数将ShowWindow函数与加载事件挂钩, 例如:

 protected void Button1_Click(object sender, EventArgs e) 
    { 
        string script = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(ShowWindow);</script>"; 
        ClientScript.RegisterStartupScript(this.GetType(), "showWindoww", script);  
    }

单击此处了解有关Sys.Application.add_load的更多详细信息

谢谢。

于 2012-10-15T11:26:31.477 回答