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

rad window is not opening from server side

1 Answer 287 Views
Button
This is a migrated thread and some comments may be shown as answers.
Binary
Top achievements
Rank 1
Binary asked on 22 May 2015, 02:59 AM

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);
        }

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 22 May 2015, 01:27 PM

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
Tags
Button
Asked by
Binary
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or