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

Using a RadWindow to update combobox items

1 Answer 40 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 05 Aug 2010, 06:23 PM

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.

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 10 Aug 2010, 09:47 AM
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
Tags
Ajax
Asked by
Matt
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or