Using a RadWindow to update combobox items

2 posts, 0 answers
  1. Matt
    Matt avatar
    10 posts
    Member since:
    Feb 2006

    Posted 05 Aug 2010 Link to this post

    I have a user control with an AjaxManagerProxy on it, a RadComboBox, a button, and a RadWindow. Users click the button to open the RadWindow to add an item to the RadComboBox. After they click save, the record is inserted into the database, the window is closed and a javascript method is executed to "rebind" the combobox. Unfortunately the combobox items are not updated, however, if I click the button to add another item and just close the window the list is updated. If I click the button and add another button, the item I previously added appears in the list but not the current one.

    Here is some code from the user control.

        <telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnNewDepartment">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rdoDepartment" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
              
    <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true" runat="server">
        <Windows>
            <telerik:RadWindow ID="NewDepartmentDialog" runat="server" Width="500px" Left="150px" Height="425px" Behaviors="Close" Title="New Department Details" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" OnClientClose="OnDepartmentWindowClose" />
        </Windows>
    </telerik:RadWindowManager>
          
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="20">
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
        </telerik:RadAjaxLoadingPanel>

    <telerik:RadComboBox ID="rdoDepartment" runat="server" width="300px" DataTextField="DepartmentName" DataValueField="DepartmentCode" MarkFirstMatch="true" /><asp:TextBox ID="txtEmployeeDepartmentRegularlyWorked" runat="server" MaxLength="50" Width="150px" />

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript" language="javascript">
            function ShowInsertForm() {
                window.radopen("Window.aspx", "NewDepartmentDialog");
                return false;
            }
            function OnDepartmentWindowClose(sender, args) {
                $find("<%=RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("rebindDepartment");
            }
        </script>
    </telerik:RadCodeBlock>

    Protected Sub manager_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs)
        Select Case e.Argument
            Case "rebindDepartment"
                Me.rdoDepartment.Items.Clear()
                Me.rdoDepartment.DataSource = db.SPs.CompanyDepartmentListSelect(Utility.GetCompanyKey).GetDataSet
                Me.rdoDepartment.DataBind()
                Me.rdoDepartment.Items.Insert(0, New RadComboBoxItem("", ""))
        End Select
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
        AddHandler manager.AjaxRequest, AddressOf manager_AjaxRequest
    End Sub

    Please advise.
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 10 Aug 2010 Link to this post

    Hi Matt,

    Could you please elaborate a bit more on your application? Does the issue appear if the ajax is disabled on the page and regular postback is used?
    If it is convenient for you please open a regular support ticket and send us sample runnable application whish demonstrates the problem. We will debug it locally and advise you further.


    All the best,
    Maria Ilieva
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top