Hi,
I have a grid with some columns being updated by a stored procedure from the code behind when a user clicks a button. This button executes an Ajaxrequest on the client to fire the stored procedure handled in RadAjaxManager1.AjaxRequest code behind, and the database is updated as expected. The problem is now with the displayed grid because it's not being refreshed with the latest changes...
Javascript code:
ASP.NET
Code Behind:
The rebind command doesn't update the view...
I also tried another approach within the JS, forcing a postback
I checked this similar threat http://www.telerik.com/community/forums/aspnet-ajax/grid/rebind-a-grid-with-an-ajaxrequest.aspx, experiencing the same problem but the answer does not help me. All I need is an ability to rebind the bind after the ajaxrequest.
Any solution?
Thanks!
I have a grid with some columns being updated by a stored procedure from the code behind when a user clicks a button. This button executes an Ajaxrequest on the client to fire the stored procedure handled in RadAjaxManager1.AjaxRequest code behind, and the database is updated as expected. The problem is now with the displayed grid because it's not being refreshed with the latest changes...
Javascript code:
function buttonResetClick(sender, args) {if .... some conditions... {radconfirm("Changing the currency will reset all product prices. Continue?", aspButtonCallbackFn, 380, 110, null, "Confirm price reset"); return false;}function aspButtonCallbackFn(arg) { if (arg) { refreshGrid(orderCreated.value, actualCurrency.get_selectedItem().get_value()); } }}function refreshGrid(arg, currency) { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("ResetAndRebind," + arg + "," + currency);// Try to force a Postback, grid is not updated
// __doPostBack("<%= ProcessBtn.UniqueID%>", "");
}ASP.NET
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls><telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /></UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /><telerik:RadButton ID="ProcessBtn" OnClientClicked="buttonResetClick" AutoPostBack="false" runat="server" Text="Process Currency" CausesValidation="true" ValidationGroup="MainCurdata" /><telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" GridLines="None" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowAutomaticDeletes="False" ondeletecommand="RadGrid1_DeleteCommand" AllowMultiRowEdit="True" Visible="false"> <ClientSettings ClientEvents-OnRowCreated="countRows"><ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" OnGridCreated="GridCreated" OnCommand="GridCommand"></ClientEvents></ClientSettings> <MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="false" EditMode="InPlace" DataKeyNames="Id,OrderId"><Columns> LIST </Columns></MasterTableView> <FilterMenu EnableImageSprites="False" /></telerik:RadGrid>Code Behind:
The rebind command doesn't update the view...
Protected Sub RadAjaxManager1_AjaxRequest(sender As Object, e As AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest Dim argument As String = e.Argument Dim stringArray As [String]() = argument.Split(",".ToCharArray()) Dim orderId As Integer = stringArray(1) If stringArray(0) = "ResetAndRebind" Then Using Context As New StocksEntities() Context.currencyResetFields(orderId)STORED PROCEDURE UPDATE Context.SaveChanges() End Using RadGrid1.Rebind() End If End SubI also tried another approach within the JS, forcing a postback
(__doPostBack("<%= ProcessBtn.UniqueID%>", "");) after the ajaxrequest, but unfortunately the postback is conducted before ajax ends the request...I checked this similar threat http://www.telerik.com/community/forums/aspnet-ajax/grid/rebind-a-grid-with-an-ajaxrequest.aspx, experiencing the same problem but the answer does not help me. All I need is an ability to rebind the bind after the ajaxrequest.
Any solution?
Thanks!