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

AJAX Modal window

2 Answers 164 Views
Window
This is a migrated thread and some comments may be shown as answers.
AXOR
Top achievements
Rank 1
AXOR asked on 15 Feb 2011, 03:24 PM
Hello,

I'm trying to setup a modal window to display a form, then after completing the form I need to update a control on the current page from the data that was added to database.

Here's the code I'm using:

 

<telerik:RadComboBox ID="cboIndustrie" ToolTip="Industrie d'appartenance de l'entreprise." Width="200" AllowCustomText="false" runat="server"
</telerik:RadComboBox
  
<asp:LinkButton Text="[Ajouter une industrie]" runat="server" CausesValidation="false" ID="lnkIndustrie"
OnClientClick="window.radopen(null, 'windowIndustrie'); return false;" OnClick="lnkIndustrie_Click"></asp:LinkButton
  
<telerik:RadWindowManager ID="windowManager" runat="server"
<Windows
<telerik:RadWindow ID="windowIndustrie" Title="Nouvelle industrie" ShowContentDuringLoad="false" 
Width="400px" Height="200px" Behaviors="Default" runat="server" EnableShadow="true" Modal="true" 
NavigateUrl="AddIndustrie.aspx" VisibleStatusbar="false" /> 
</Windows
</telerik:RadWindowManager
  
<telerik:RadAjaxManager ID="ajaxManager" runat="server"
<AjaxSettings
<telerik:AjaxSetting AjaxControlID="lnkIndustrie"
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="cboIndustrie" /> 
</UpdatedControls
</telerik:AjaxSetting
</AjaxSettings
</telerik:RadAjaxManager

 

The general execution process is working fine, but if I remove "return false;" after calling window.radopen() the page will reload while users are filling my form. So, I need to find a way to hold execution while windowIndustrie is open.

As a work around, I tried to add an invisible button that would be fired with OnClientClose event of my window, but I can't get it working...

Thanks,
Frédéric

2 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 16 Feb 2011, 02:04 PM
Hello Service,

Your RadAjaxManager declaration should look like this:

<telerik:RadAjaxManager ID="ajaxManager" runat="server">  
<AjaxSettings>  
<telerik:AjaxSetting AjaxControlID="ajaxManager">  
<UpdatedControls
<telerik:AjaxUpdatedControl ControlID="cboIndustrie" />  
</UpdatedControls>  
</telerik:AjaxSetting>  
</AjaxSettings>  
</telerik:RadAjaxManager>

Where the RadAjaxManager is the one that raises the Ajax request and updates the RadComboBox. You then handle your RadWindow's OnClientClose event and call the RadAjaxManager's ajaxRequest method. Like so:

function OnClientClose(sender, args){
    var ajaxManager = $find("<%= ajaxManager.ClientID %>");
   ajaxManager.ajaxRequest("UpdateRadComboBox");
}

You then handle the RadAjaxManager's OnAjaxRequest event, check that e.Argument == "UpdateRadComboBox", and add the code you had in your LinkButton's click event.

 

I hope that helps.

0
AXOR
Top achievements
Rank 1
answered on 16 Feb 2011, 08:32 PM
Thanks for your help. It worked perfectly.
Tags
Window
Asked by
AXOR
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
AXOR
Top achievements
Rank 1
Share this question
or