This is a migrated thread and some comments may be shown as answers.

[Solved] preventing window from showing each time page is reloaded

4 Answers 134 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 11 Feb 2008, 10:41 PM
I realize that the reason my radwindow loads every time the page is reloaded is because I have the visibleonpageload property set to true, but I don't want this behavior to happen.  I have looked at a similar post located at http://www.telerik.com/community/forums/thread/b311D-mhctd.aspx, but I need a more concrete example of how you can prevent the window from popping up every single time the page is reloaded.  I want the window to load up only when the user clicks on the appropriate asp:linkbutton control.

Thanks,
Dave

4 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 12 Feb 2008, 03:43 PM
Hello Dave,

The code that Tsvetie posted at the end of the other forum thread is exactly what you need. Basically, before you open a RadWindow you need to check for a flag in the session that "tells" you if such window is already opened and to set VisibleOnPageLoad to true only if this flag is not present.





Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Dave
Top achievements
Rank 1
answered on 12 Feb 2008, 03:53 PM

I tried using Tsvetie's code, but that code didn't work because once you set that session variable, it will prevent the window from loading up even when the user didn't reload the page, but actually clicked on the appropriate linkbutton.  Am I missing something?  It doesn't seem like that code would work.  Here's what I did.  I put the following code in the click event of my linkbutton:

Protected Sub lnbProjRole_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnbProjRole.Click  
 
Dim reload As String = Session.Item("reload")  
 
If String.IsNullOrEmpty(reload) Then  
 
   
 
'Create a new window and add it dynamically  
 
   
 
Dim newWindow As RadWindow = New RadWindow  
 
newWindow.ID = "RadWindow1" 
 
   
 
newWindow.NavigateUrl = "./Dialog.aspx" 
 
   
 
newWindow.VisibleOnPageLoad = True 
 
   
 
newWindow.Enabled = True 
 
   
 
newWindow.Visible = True 
 
   
 
newWindow.Width = 285 
 
newWindow.Height = 650 
 
newWindow.Behaviors = WindowBehaviors.Close  
 
newWindow.Skin = "WebBlue" 
 
   
 
newWindow.OffsetElementID = "searchArea" 
 
   
 
newWindow.ReloadOnShow = True 
 
   
 
newWindow.Modal = True 
 
   
 
newWindow.OnClientClose = "initiateCallback" 
 
   
 
newWindow.VisibleStatusbar = False 
 
   
 
'Add the newly created RadWindow to the RadWindowManager's collection  
 
   
 
Singleton.Windows.Add(newWindow)  
 
End If  
 
   
 
End Sub  
 

 I also added the following line of code to the click event of the postback button that gets clicked after the radwindow is closed:

Session.Add(

"reload", "blahblahblah")

The problem is that this code only allows the radwindow to open once and only once per session.  I want the user to be able to open the radwindow as many times as they want by clicking on the linkbutton.  I only want the radwindow not to show if they just reloaded the page.

0
Dave
Top achievements
Rank 1
answered on 12 Feb 2008, 03:55 PM
By the way, I just opened a support ticket regarding this.
0
Svetlina Anati
Telerik team
answered on 13 Feb 2008, 04:58 PM
Hi Dave,

I have just answered your support ticket.


All the best,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Dave
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Dave
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or