Refreshing RadComboBox on RadWindow Close

4 posts, 1 answers
  1. Dhanesh
    Dhanesh avatar
    4 posts
    Member since:
    Jul 2010

    Posted 25 Nov 2010 Link to this post

    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!

  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 26 Nov 2010 Link to this post

    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.
  3. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 26 Nov 2010 Link to this post

    After reviewing what I said, I noticed you include the RadAjaxPanel in your AjaxSettings. I would change the RadAjaxPanel to a normal Panel control.
  4. Dhanesh
    Dhanesh avatar
    4 posts
    Member since:
    Jul 2010

    Posted 30 Nov 2010 Link to this post

    Thanks @Cori, that helped !
Back to Top