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

Refreshing RadComboBox on RadWindow Close

3 Answers 97 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Dhanesh
Top achievements
Rank 1
Dhanesh asked on 25 Nov 2010, 03:37 PM
Hi,

I am new to Telerik RadControls, hence kindly excuse any mistakes. What I am trying to achieve is:

1) A web page with RadComboBox and a hyper link.
2) User clicks on Hyper Link to Open a Rad Window. User enters a value and saves value to database.
3) RadWindows closes. The RadCombo box on the parent window should be refreshed.

Going thru other posts, I was able to achieve all three and the RadCombo is also bound when the Radwindow closes, but it does not refresh. It still shows the old values ( and not the new value). If you explicitly refresh the page then it will populate RadCombo with new value.

Please advise. This is the code I am using:

Home.aspx where the RadCombo control is:
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" >
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1" >
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="radddl" LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy >
   
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" >
    </telerik:RadAjaxLoadingPanel>

Home.aspx - Javascript to make an ajaxrequest on radwindow close:
function closeRadWindow()
     {
         //debugger WORKS!
         $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");         
     }

Home.aspx - RadCombo and a Hyperlink:
<td>
                        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="50px" Width="50px"
                         LoadingPanelID="RadAjaxLoadingPanel1"
                        >
                            <telerik:RadComboBox ID="radddl" runat="server"   >
                            </telerik:RadComboBox>
                        </telerik:RadAjaxPanel>
                    </td>
                    <td>
                         <a href="#"  id="link1" >
                            Add Category
                         </a>                   
                    </td>

Home.aspx - to open the radwindow
<telerik:RadWindowManager ID="RadWindowManager2" runat="server"
           <Windows
               <telerik:RadWindow ID="AddCategoryWindow" runat="server" OnClientClose="closeRadWindow"
                                   Behaviors="Close"  NavigateUrl="~/template/AddTemplateCategory.aspx"
                                   OpenerElementID="link1" modal="true"  Height="200px" Width="200px"
                                   ShowContentDuringLoad="false" Title="Add Category" VisibleStatusbar="false"
                                   
               </telerik:RadWindow
           </Windows
   </telerik:RadWindowManager>

Home.aspx - code behind:
protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           this.LoadCategoryList();
       }
 
       RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(Page);
       ajaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(ajaxManager_AjaxRequest);
   }

Home.aspx - Ajax request. Load Category List actually makes a database call and binds to RadCombo
protected void ajaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
   {
       this.LoadCategoryList();
   }

TIA!

3 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 26 Nov 2010, 02:11 PM
Hello Dhanesh,

If your using the RadAjaxManager control, there is no reason to wrap your RadComboBox inside of a RadAjaxPanel. Also, it's not recommended to use the two controls together. So I would remove the RadAjaxPanel from your page.

Also, in your AjaxRequest event, I would also check the argument passed, so your not executing that code on ajax requests that aren't related to the RadComboBox.

I hope that helps.
0
Accepted
Cori
Top achievements
Rank 2
answered on 26 Nov 2010, 02:13 PM
After reviewing what I said, I noticed you include the RadAjaxPanel in your AjaxSettings. I would change the RadAjaxPanel to a normal Panel control.
0
Dhanesh
Top achievements
Rank 1
answered on 30 Nov 2010, 02:25 PM
Thanks @Cori, that helped !
Tags
Ajax
Asked by
Dhanesh
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Dhanesh
Top achievements
Rank 1
Share this question
or