I have the following markup on my aspx page:
<telerik:RadAjaxManagerProxy runat="server" ID="MyAjaxManagerProxy"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="MyRadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="MyRadGrid1" LoadingPanelID="AjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManagerProxy> <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Transparency="20"> <telerik:RadCodeBlock ID="VpLaborHourlyRadCodeBlock1" runat="server"> <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0;" /> </telerik:RadCodeBlock> </telerik:RadAjaxLoadingPanel>
My radgrid declaration immediately follows.
I have a delete button in each row of my radgrid. The delete event handler is implemented in ItemCommand as so:
protected void MyRadGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName)
{
// Save the row into database.
}
else if (e.CommandName == RadGrid.DeleteCommandName)
{
// Delete the row from the database.
}
}
The delete function works fine, that is, the row does get deleted from the database. There is only one problem as described below.
The first time I delete a row, ajax works perfectly, no full postback, the grid stays where it is and get rebound nicely after delete completes.
The second time I delete a row, it still successfully deletes the row from the database, but it does a full postback, and the entire page reloads, totally without the nice ajax feature.
What's wrong? Any hint please?