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

Open RadWindow from CodeBehind in VB

6 Answers 672 Views
Window
This is a migrated thread and some comments may be shown as answers.
ClarkSRoberts
Top achievements
Rank 1
ClarkSRoberts asked on 02 Jun 2009, 11:08 PM
I have seen a couple of examples of opening a window from codebehind using C#., but none using VBScript. I must be the last guy on earth using VB.

Can anyone post a code sample of how to open a RadWindow from codebehind with VB Script?

Thanks

6 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 03 Jun 2009, 11:49 AM
Hi ClarkSRoberts,

Every article in our documentation that uses server-side code, provides C# and VB.NET versions of that code. In your case I suggest to check the following link:
http://www.telerik.com/help/aspnet-ajax/window_settingserversideproperties.html

As you can see, to open a RadWindow from the server, you need to:
  1. Create the window or use already created one
  2. Set the properties that you need (Width, Height, etc.)
  3. Set its VisibleOnPageLoad property to true
  4. If the RadWindow is a new one - to add it to the page as a standalone control or in the Windows collection of an existing RadWindowManager.
e.g.
'Create a new window add it dynamically 
'The window will inherit the default settings of parent WindowManager 
Dim newWindow As New Telerik.Web.UI.RadWindow() 
newWindow.NavigateUrl = "http://www.sitefinity.com" 
'Top and Left can be used in conjunction with the OffsetElementId (if no OffsetElementId is specified, the top left corner of the browser window is used 
newWindow.Top = Unit.Pixel(22) 
newWindow.Left = Unit.Pixel(0) 
'OPTION 1 
'Add the newly created RadWindow to the RadWindowManager's collection 
'WindowManager.Windows.Add(newWindow) 
'OPTION 2 
'since in the for ASP.NET AJAX version you can have a RadWindow outside of a RadWindowManager 
'as a separate control, you can add the newly created RadWindow directly to the form's Controls collection 
form1.Controls.Add(newWindow) 


Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
pedrotti
Top achievements
Rank 1
answered on 20 Oct 2011, 04:18 PM
Hi Georgi Tunev
In your example you create a window but you do not open it

How to open it automatically (for example after a click on a button (check of data on the server and  if OK we open the window)

Thank you in advance for your help

Anne
0
Princy
Top achievements
Rank 2
answered on 21 Oct 2011, 07:01 AM
Hello Levefaude,

You can try the following code snippet to open RadWindow on button click.

VB:
Protected Sub Button1_Click(sender As Object, e As EventArgs)
    Dim script As String = "function f(){$find(""" + RadWindow1.ClientID & """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
    ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)
End Sub
                       OR
  
Protected Sub Button1_Click(sender As Object, e As EventArgs)
        RadWindow1.VisibleOnPageLoad = True
    RadWindowManager1.Windows.Add(RadWindow1)
End Sub

Thanks,
Princy.
0
pedrotti
Top achievements
Rank 1
answered on 21 Oct 2011, 10:01 AM
Thank you,

But it does not work with an a little bit complex procedure, and with radbutton, maybe be i work with asp button ?

Thank you and have a good day

Anne
0
Marin Bratanov
Telerik team
answered on 25 Oct 2011, 04:02 PM
Hello Levefaude,

Please examine the following sticky thread on opening a RadWindow from the server: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx. This approach works in a more complex logic and it does not matter whether the postback is initiated from a regular button, radbutton, linkbutton etc.


Greetings,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
pedrotti
Top achievements
Rank 1
answered on 27 Oct 2011, 08:58 AM
Thank you, that works very well
Have a good day, rainy in France

Anne
Tags
Window
Asked by
ClarkSRoberts
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
pedrotti
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or