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

How can i call the server side function when closing the radwindow

1 Answer 174 Views
Window
This is a migrated thread and some comments may be shown as answers.
Lenin
Top achievements
Rank 1
Lenin asked on 31 Jan 2009, 01:46 PM
I have used the rad wiindow for popup and enter some data then save it to the database . i want to refresh the combo box when the rad windoe is closed.
i have wrriten the code leike this

function

openRadWindow(CustomerID)

 

{

 

var oWnd = radopen("AddPopup.aspx?CustomerID=" + CustomerID, "RadWindow1" );

 

oWnd.Center();

oWnd.add_close(OnClientCloseWin);

 

}

 

function OnClientCloseWin()

 

{

 

var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");

 

ajaxManager.ajaxRequestWithTarget(

'<%= btn.UniqueID %>', '');

 

 

}
its working fine in asp.net pages, but not support in master-content pages.
this code  loads the page every time when cliking the button.

i need to call server side function without postbacking....

please reply me immediately...

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Feb 2009, 05:52 AM
Hi Lenin,

Try using AjaxRequest() event instead of ajaxRequestWithTarget() to refresh the RadComboItems. When AjaxRequest() is called on the client it can be handled in the ajaxRequest event handler on the server. See the example.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" onajaxrequest="RadAjaxManager1_AjaxRequest"
     <AjaxSettings> 
         <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
             <UpdatedControls> 
                 <telerik:AjaxUpdatedControl ControlID="RadComboBox1" /> 
             </UpdatedControls> 
         </telerik:AjaxSetting> 
     </AjaxSettings> 
</telerik:RadAjaxManager> 
<telerik:RadWindowManager ID="RadWindowManager" runat="server"  Skin="Web20"
</telerik:RadWindowManager> 

JavaScript:
<script language="javascript" type="text/javascript">  
function openRadWindow(CustomerID) 
    var oWnd = radopen("AddPopup.aspx?CustomerID=" + CustomerID, "RadWindow1" );  
    oWnd.Center(); 
    oWnd.add_close(OnClientCloseWin); 
function OnClientCloseWin() 
   $find("<%=RadAjaxManager1.ClientID%>").ajaxRequest(); 
</script>  

CS:
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) 
     //Refresh the RadComboBoxItems 

Refer the online documentation for more details about AjaxRequest()
RadAjax for ASP.NET AJAX (Client-Side API)

Thanks,
Shinu.
Tags
Window
Asked by
Lenin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or