Hello,
I'm opening a RadWindow that allows a user to enter a record into a database. On the OnClientClose() event, I'm trying to refresh a RadListBox that is in a RadAjaxPanel in the parent page. This seems like it should be straight forward but I'm not having any luck. I'm new to web programming so I'm sure I just don't understand something. I am making it to the code behind once the window is closed so I know the DataBind() is executing. However, while I see the loading panel displayed the new item does not show up in the RadListBox. Any ideas as to what I'm doing wrong? Thanks!
I'm opening a RadWindow that allows a user to enter a record into a database. On the OnClientClose() event, I'm trying to refresh a RadListBox that is in a RadAjaxPanel in the parent page. This seems like it should be straight forward but I'm not having any luck. I'm new to web programming so I'm sure I just don't understand something. I am making it to the code behind once the window is closed so I know the DataBind() is executing. However, while I see the loading panel displayed the new item does not show up in the RadListBox. Any ideas as to what I'm doing wrong? Thanks!
ASP
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="lstProducts" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7" /> <qsf:InformationBox runat="server" Title="Please note you can't obsolete a product if it is still in use by another team.<br>You can add or edit products by right-clicking on the 'Products' box." Width="97%"> </qsf:InformationBox> <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px" OnAjaxRequest="RadAjaxPanel1_AjaxRequest"> <telerik:RadListBox ID="lstProducts" runat="server" AllowTransfer="True" AutoPostBackOnTransfer="True" DataSortField="PRODUCT" DataSourceID="SqlDataSource1" DataTextField="PRODUCT" DataValueField="PRODUCT_ID" EnableDragAndDrop="True" Height="250px" OnTransferred="lstProducts_Transferred" SelectionMode="Multiple" Skin="Windows7" OnClientContextMenu="showContextMenu" Style="top: 0px; left: 0px; width: 215px" TransferToID="lstObsolete" AllowAutomaticUpdates="True"> </telerik:RadListBox> </telerik:RadAjaxPanel>
Javascript
function OnClientClose() { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); }
C#
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) { if (e.Argument == "Rebind") { lstProducts.DataBind(); //i do make it here } }