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

VisibleOnPageLoad Problem

3 Answers 508 Views
Window
This is a migrated thread and some comments may be shown as answers.
Orest
Top achievements
Rank 1
Orest asked on 22 Jan 2011, 10:21 PM
Hi,

I have created a RadWindow in a user buttonClick event:
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim newWindow As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow()
        Dim hyper As String
        hyper = "GeoCode.aspx?field1=" + Street + "&field2=" + City + "&field3=" + Zip
        newWindow.NavigateUrl = hyper
        newWindow.Top = Unit.Pixel(22)
        newWindow.Left = Unit.Pixel(0)
        newWindow.Width = 300
        newWindow.Height = 800
        form1.Controls.Add(newWindow)
        newWindow.VisibleOnPageLoad = True
 
End Sub
the Url is working properly and the page is loading properly, However if i try and use newWindow.Visible = true rather than VisibleOnPageLoad = true the window does not show. my problem resides in the fact that even after I use the close event in the popup windows page the popup is loaded again once the page is loaded because of the VisibleOnPageLoad = true.

I have tried using:
function CloseFunction()
         {
          var oWnd = GetRadWindow();
           oWnd.Close();
           oWnd.VisibleOnPageLoad = false;
           oWnd.BrowserWindow.location.reload(); 
            
         
         
         }
in the other page when closing the window however it does not work. Any suggestions would be greatly appreciated

Thank you,

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Jan 2011, 11:55 AM
Hello Orest,You can try any of the following approaches,
  • set the  the property VisibleonPageLoad conditionally, on each postback.
  • Enable Viewstate to false for the RadWindowManager.
  • Show the RadWindow through registering a script from the server instead of using server code.
Also check out the following form which discussed similar scenario.
Stop RadWindow from always loading on page postback
Thanks,
Shinu.
0
Orest
Top achievements
Rank 1
answered on 25 Jan 2011, 02:46 AM
neither of those solutions seem to be working for me.
Within the .aspx.cs file opened I cannot seem to close the window or set its VisibleOnPageLoad to false.
I do not have the problem of the popup loading again if i use the x(close button) in the top right hand corner of the RadWindow.
this is the javascript code used in  the buttonclick for the opened RadWindow.
function usermade()
           {
            var oWnd = GetRadWindow();
             oWnd.EnableViewState = false;
             oWnd.DestroyOnClose = true;
             oWnd.VisibleOnPageLoad = false;
             oWnd.Close();
       
 
//reloading the parent page
             oWnd.BrowserWindow.location.reload();
             
            //GridItemType[] itemTypes = new GridItemType[]{GridItemType.EditFormItem};
            //var LonT= ownd.BrowserWindow.Location.RadGrid1.MasterTableView.GetItems(itemTypes)
//[1].FindControl("LongitudeTextBox");
           // LonT.Text = "123";
             
      
           }


0
Georgi Tunev
Telerik team
answered on 27 Jan 2011, 08:38 AM
Hello Orest,

These lines of code:
oWnd.EnableViewState = false;
oWnd.DestroyOnClose = true;
oWnd.VisibleOnPageLoad = false;

wouldn't do anything. With them, you are simply setting some custom properties to the oWnd object. To be able to control the RadWindow object on the client, you need to use its client-side API.
As for the problem itself, I believe it is coming from the following line:
oWnd.BrowserWindow.location.reload();
with it, you simulate pressing F5 on the main page, i.e. the postdata will be submitted again, and the VisibleOnPageLoad property will again take effect.
This being said, I would suggest to open the RadWindow not from the server (with the VisibleOnPageLoad) property, but on the client with JavaScript.  If you need to open the RadWindow after some server-side event, you need to output JS code that would use the client-side API of the window to show it.

I hope this helps. If you still experience problems, please open a support ticket and send us a sample project that reproduces your exact setup so we can get a better view over your case and provide you with the most appropriate solution.

Kind regards,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Window
Asked by
Orest
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Orest
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or