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

How to display editing error message

4 Answers 369 Views
Grid
This is a migrated thread and some comments may be shown as answers.
skysailor
Top achievements
Rank 1
skysailor asked on 08 May 2008, 07:04 AM
Hi,
I have a RadGrid and I'm using popup editing of records (which I love!). I am using the UpdateCommand event to save the data to my database. If any error occurs during save how can I display a message to the user? I set e.Canceled = true which stops the popup form from being dismissed - but how can I put a message or some indication that the save failed onto the popup form?
Clayton.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 May 2008, 08:48 AM
Hi,

Go through the following help document link.
Error handling automatic operations

Shinu.
0
skysailor
Top achievements
Rank 1
answered on 08 May 2008, 11:09 PM
Hi,
That example is not useful.
I am using manual updates - not automatic updates. So I am using the UpdateCommand event which has different arguments. It just has a Cancelled property.
And I am using popup mode for editing - adding a literal at the bottom of the grid is no use, it is not even visible to the popup.
Clayton.
0
Sebastian
Telerik team
answered on 12 May 2008, 11:58 AM
Hello skysailor,

For your convenience I prepared a sample demo which illustrates how to output error message in a label below the grid when update/insert operation is cancelled. Note that in my case the update/insert action will be interrupted every time, however you can replace the conditional check with your custom logic to meet your development schema.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
skysailor
Top achievements
Rank 1
answered on 13 May 2008, 12:21 AM
I'm sorry but you seem to have missed the point again. I'm not using a statically defined datasource. I'm using the UpdateCommand event - it has different parameters.
And I amd using the pop-up edit option. It comes up in a RadWindow. I need to be able to add controls to the RadWindow NOT below the grid.

After much mucking around here is what I got to work. If anyone has an easier way to do it that would be very helpful :-
  private void DisplayMessage(GridEditFormItem item, String col, string Msg)  
  {  
    TableCell cell = null;  
    try  
    {  
      GridTextBoxColumnEditor editor = item.EditManager.GetColumnEditor(col) as GridTextBoxColumnEditor;  
      if (editor == null) return;  
      cell = editor.TextBoxControl.Parent.Parent.Parent.Parent as TableCell;  
    }  
    catch { }  
    if (cell == null) return;  
 
    Label lb = new Label();  
    lb.Text = Msg;  
    cell.Controls.Add(lb);  
  }  
 
Tags
Grid
Asked by
skysailor
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
skysailor
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or