Telerik window automatically opens after every page refresh

Posted by CSharpDev4Evr on Stack Overflow See other posts from Stack Overflow or by CSharpDev4Evr
Published on 2013-11-04T13:40:38Z Indexed on 2013/11/05 15:54 UTC
Read the original article Hit count: 298

Filed under:
|
|
|
|

I am using Telerik RadControls in my project and and have a menu where I have an 'About' button. When I click the 'About' button a window pops up describing the application. The problem is if I refresh the page or navigate to another page then back to the first page the window automatically pops up.

The goal is only have that window pop up when the user clicks the about button.

here is the code I used to get that window:

<!--About Window-->
<telerik:RadWindowManager runat="server" EnableViewState="false" KeepInScreenBounds="true"></telerik:RadWindowManager>
<telerik:RadWindow ID="AboutMenu" Behaviors="Close" Animation="None" runat="server" Width="360px" KeepInScreenBounds="true" Height="360px" Modal="true" VisibleStatusbar="false" Skin="Glow">
<ContentTemplate>
<p style="text-align: center;">Sample Window Information</p>
</ContentTemplate>
</telerik:RadWindow>

Javascript

function OnClientItemClick(sender, eventArgs) {
             if (window.args.get_item().get_text() == "About") {
                 var radwindow = window.$find(window.AboutMenu.ClientID);
                 window.args.set_cancel(true);
             }
         }

.cs

 protected void MainMenu_OnItemClick(object sender, RadMenuEventArgs e)
        {
            if (e.Item.Text == "About")
            {
                AboutMenu.VisibleOnPageLoad = true;
            }
        }

The window works but it loads whenever the page loads and thats where I think the line AboutMenu.VisibleOnPageLoad = true comes into play and is causing the error but when I take out that line it won't display at all.

© Stack Overflow or respective owner

Related posts about c#

Related posts about menu