Open Radwindow onload in master page

3 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 27 Mar 2014 Link to this post

    I have a page that sits inside a master page so I do not have a body to do an onload statement, by research everyone says use the registerstartUpscript and it will work, however it is not.  How can I call a radwindow on page load from a page nested in a master site.  Thanks

    function SelectInfo() {
    <telerik:RadWindow ID="rwInfo" runat="server" Modal="true" NavigateUrl="Info.aspx" Width="1000px" Height="800px" OnClientClose="closeWindow"></telerik:RadWindow>
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
          If Not IsPostBack Then
              Dim userlogon As String = Split(Current.User.Identity.Name, "\")(1)
              HFUserId.Value = GetUserId(userlogon)
              If CheckIMOs(userlogon) = True Then
                  Dim page As Label = CType(Master.FindControl("lblPage"), Label)
                  page.Text = " - Move Add Change"
                  ScriptManager.RegisterStartupScript(page, page.GetType(), "SomestartupScript", "SelectInfo();", True)
              End If
          End If
      End Sub
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 31 Mar 2014 in reply to Kevin Link to this post

    Hi Kevin,

    I guess that you want to show a RadWindow, which is inside the MasterPage on the PageLoad of content page. Please have a look into the sample code snippet which works as expected for me. Please elaborate your requirement if it doesn't help.

    Master Page:
    <telerik:RadWindow ID="RadWindow1" runat="server">
            <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="Demo">

    Content Page VB:
    Protected Sub Page_Load(sender As Object, e As EventArgs)
        Dim script As String = "function f(){showWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Page, Page.[GetType](), "key", script, True)
    End Sub

    <script type="text/javascript">
        function showWindow() {
            $find("<%=RadWindow1.ClientID %>").show();

  3. DevCraft R3 2016 release webinar banner
  4. Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 31 Mar 2014 Link to this post

    Hello Kevin,

    There are two key points in this code that can prevent a RadWindow from showing up:

    • the Sys.Application.Load event should be used if the RadWindow is disposed (i.e., a full postback or a partial postback that includes the RadWindow are initiated), as shown here:
    • The Response.Redirect call (if executed), will change the entire pages response, so the script registration will not travel to the client, but only a redirect to the new page.

    I hope this helps.

    Regards, Marin Bratanov

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

Back to Top