简体   繁体   中英

How to close radwindow in asp.net without refresh page?

I have a radwindow that open by btnShowWindow , but when Page is refresh or reload , radwindow is close.

What do I?

<div>
    <asp:Button ID="btnShowWindow" runat="server" Text="ُShow" />
<br />
    <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="true" VisibleStatusbar="false"
        RegisterWithScriptManager="True" EnableShadow="True" ReloadOnShow="true" Width="760px"
        Height="350px" runat="server">
        <Windows>
            <telerik:RadWindow ID="modalPopup" runat="server" Modal="True" OpenerElementID="btnShowWindow">
                <ContentTemplate>
                    <asp:Button ID="Button1" runat="server" Text="AddName" OnClick="Button1_Click" />
                    <asp:Label ID="lblName" runat="server" ></asp:Label>
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
</div>

in Default.aspx.cs

When I click to Button1 , radWindow is close. I do not want close radwindow. I want close radwindow on button.

protected void Button1_Click(object sender, EventArgs e)
{
    lblName.Text = "Hello!";
}

I didnt really understand your scenario but you could try this:

 <telerik:RadScriptBlock runat="server" ID="scriptBlock">

        <script type="text/javascript">
            //<![CDATA[
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
            function CloseWin() {
                //Get the RadWindow  
                var oWindow = GetRadWindow();
                //Call its Close() method
                if (oWindow) {
                    oWindow.Close();
                }
                return false;
            }
 </script>

    </telerik:RadScriptBlock>

And in the ASPX page :

<asp:Button ID="btnClose" Text="Close" runat="server" CssClass="button" Enabled="true"
                                                OnClientClick="CloseWin();" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM