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

Display a Confirmation after insert or update

2 Answers 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 13 Aug 2013, 06:50 PM
I need to display a confirmation of some sort, preferably just a simple Label that will say complete or failed after a user inserts or updates a record in my RadGrid. This seems like it should be so simple but it does not appear that I can reach my label from within the InsertCommand event. So how do I detect that the insert or update has completed then display the ASP label with the confirmation? 

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 14 Aug 2013, 04:14 AM
Hi John,

I guess you might be doing manual CRUD operation with Ajax for your RadGrid.In order to display the asp label,you can add it to the Ajax settings as follows.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" EnableAJAX="true" runat="server">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadGrid1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1">
                       </telerik:AjaxUpdatedControl>
                       <telerik:AjaxUpdatedControl ControlID="Label1" LoadingPanelID="RadAjaxLoadingPanel1" />                     
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
       </telerik:RadAjaxLoadingPanel>
      <telerik:RadGrid ID="RadGrid1">
      </telerik:RadGrid>
      <asp:Label ID="Label1" runat="server"></asp:Label>

C#:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
   {
       GridEditableItem edit = (GridEditableItem)e.Item;
       string OrderID = edit.GetDataKeyValue("OrderID").ToString();    
       try
       {           
           //Your code to update
           Label1.Text = "Product with OrderID " + OrderID + " is updated!";
       }
       catch (Exception ex)
       {
           Label1.Text = "Product with OrderID " + OrderID + " cannot be updated. " ;
       
 }

Thanks,
Princy
0
John
Top achievements
Rank 1
answered on 14 Aug 2013, 03:01 PM
That is what I needed, thanks!
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
John
Top achievements
Rank 1
Share this question
or