Open RadWindow from CodeBehind in VB

7 posts, 0 answers
  1. ClarkSRoberts
    ClarkSRoberts avatar
    27 posts
    Member since:
    Mar 2007

    Posted 02 Jun 2009 Link to this post

    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
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 03 Jun 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. LEVEFAUDE
    LEVEFAUDE avatar
    39 posts
    Member since:
    Apr 2011

    Posted 20 Oct 2011 Link to this post

    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
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Oct 2011 Link to this post

    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.
  6. LEVEFAUDE
    LEVEFAUDE avatar
    39 posts
    Member since:
    Apr 2011

    Posted 21 Oct 2011 Link to this post

    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
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 25 Oct 2011 Link to this post

    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
  8. LEVEFAUDE
    LEVEFAUDE avatar
    39 posts
    Member since:
    Apr 2011

    Posted 27 Oct 2011 Link to this post

    Thank you, that works very well
    Have a good day, rainy in France

    Anne
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017