rad window is not opening from server side

2 posts, 0 answers
  1. Binary
    Binary avatar
    10 posts
    Member since:
    Apr 2015

    Posted 21 May 2015 Link to this post

    I am trying to open the radwindow on button click event from server side. when I do the same from  client side with postback="false" and Onclientclicked="openRadWin" everything works fine. But If I enable the postback and try to call the javascript function openRadWin from server side  that opens the radwindow , it is not working.

    I am trying to open the radwindow based on the some condition and do some processing and return back to same original page after it completes. Below is my code snippet.

     

    <script type="text/javascript">
    function openRadWin() {
                var width = 400;
                var height = 400;
                var left = 200;
                var top = 200;/
                radopen("popupMsg.aspx", "RadWindow1", width, height, left, top);
    }
        </script> 

     

     

    <telerik:RadScriptManager ID="mgr" runat="server"></telerik:RadScriptManager>
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" Visible="false"/>

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
    <Windows>
    <telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Width="400px"
    Height="400px" Title="Telerik RadWindow" Behaviors="close">
    </telerik:RadWindow>
    </Windows>
    </telerik:RadWindowManager>

    <div class="demo-container size-thin">
    <p>
    <telerik:RadButton runat="server" id="radpopup" OnClick="btnad_Click" Text="Open RadWindow" />
    </p>
    </div>

     

      protected void btnad_Click(object sender, EventArgs e)
    {
                RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "test", "openRadWin();", true);
            }

     

     

     

     

     

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 22 May 2015 Link to this post

    Hello,

    You need to use the Sys.Application.Load event to execute that function, otherwise it will be called before the controls are instantiated on the client, and you will get a JS error. You can find an example in the following article: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-opening-from-server.html.

    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top