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

Problem with radDock and a new row in a radGridView

11 Answers 138 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 09 Jan 2018, 02:43 PM

Hi,

I have this problem:

In a Form with a RadDock, in this RadDock two ToolWindows with one button each and two DocumentWindows. In a DocumentWindow, a RadGridView.

The RadGridView is with the event UserAddingRow:

private void RadGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e)
 {
     if (e.Rows.Count() > 0 && e.Rows[0].Cells["Id"].Value == null)
     {
         e.Cancel = true;
         this.radGridView1.GridNavigator.Select(this.radGridView1.MasterView.TableAddNewRow, this.radGridView1.Columns["Id"]);
         this.radGridView1.BeginEdit();
     }
 }

 

If you are editing a new row in the RadGridView with the value of "Id" null and you click on a button or in the tab of the other DocumentWindow, you don't stay in the new row. And the UserAddingRow event is fired many time.

Why? How to edit the column "Id" of the new row if you validate by clicking in other control?

11 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Jan 2018, 07:57 AM
Hello, Pierre,   

Thank you for writing.  

I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to RowValidating event instead:

private void radGridView1_RowValidating(object sender, Telerik.WinControls.UI.RowValidatingEventArgs e)
   {
       if (e.Row is Telerik.WinControls.UI.GridViewNewRowInfo && e.Row.Cells["Id"].Value == null)
       {
           this.radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
           this.radGridView1.CurrentRow = this.radGridView1.MasterView.TableAddNewRow;
       }
   }

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Pierre
Top achievements
Rank 1
answered on 10 Jan 2018, 09:32 AM

Thank you for your quick response, but I have the same problem with the event RowValidating. It is triggered several times as you can see in the attached GIF. And we do not stay in the new line.
If we uncomment the last two lines of the code that follows, then we freeze the edition of the radgridview.

private void radGridView1_RowValidating(object sender, Telerik.WinControls.UI.RowValidatingEventArgs e)
 {
     if (e.Row is Telerik.WinControls.UI.GridViewNewRowInfo && e.Row.Cells["Id"].Value == null)
     {
         Console.WriteLine("RowValidating");
         this.radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
         this.radGridView1.CurrentRow = this.radGridView1.MasterView.TableAddNewRow;
         //this.radGridView1.GridNavigator.Select(this.radGridView1.MasterView.TableAddNewRow, this.radGridView1.Columns["Id"]);              //this.radGridView1.BeginEdit();
     }
 }
  

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Jan 2018, 02:12 PM
Hello, Pierre,  

Thank you for writing back. 

I was able to replicate the multiple firing of the RowFormatting event. An alternative solution that I can suggest is to use the CellValidating event. Thus, you will be stuck in the cell once it is focused until you enter a valid value:
private void radGridView1_CellValidating(object sender, Telerik.WinControls.UI.CellValidatingEventArgs e)
{
    Console.WriteLine("CellValidating");
    if (e.Column.Name == "Id" && e.Value == null)
    {
        e.Cancel = true;
        if (e.Row is Telerik.WinControls.UI.GridViewNewRowInfo)
        {
            this.radGridView1.MasterView.TableAddNewRow.CancelAddNewRow();
        }
    }
}

I hope this information helps. If you have any additional questions, please let me know. 

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Pierre
Top achievements
Rank 1
answered on 10 Jan 2018, 03:17 PM
I think you meant RowValidating instead of RowFormatting in your last post.
For the CellValidating unfortunately it does the same thing, several calls to CellValidating when we go through the e.cancel and then the form is no longer accessible. You can see it in the .gif attached to this post.
Do you think the fix will be quickly found because this way of using Telerik objects is necessary.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Jan 2018, 01:11 PM
Hello, Pierre,  

Thank you for writing back. 

Yes, indeed I meant RowValidating event. As to the CellValidating event, it is fired each time you try to exit the cell. It is normal behavior. When the new row becomes current you can change the current column to "Id". Thus, you won't be able to exit the cell until a valid value is entered.

I can't give you an exact timeframe when the issue will be addressed. You can track its progress, subscribe for status changes and add your comments on the following link: https://feedback.telerik.com/Project/154/Feedback/Details/240120-fix-radgridview-useraddingrow-is-fired-multiple-times-when-the-grid-is-inside

We will do out best to introduce a fix as soon as possible.

I hope this information helps. If you have any additional questions, please let me know. 

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Pierre
Top achievements
Rank 1
answered on 11 Jan 2018, 01:59 PM

I don't think CellValidating work fine, because when you change the column in the new row from "name" to "Id" it fired one. But when you change the column in the new row from "Id" to "name" it fired twice and freeze the form.

And when you change the column in the new row from "Id" to the button "Button1", it fired 4 times.


I wait for the fix

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Jan 2018, 10:12 AM
Hello, Pierre,  

Thank you for writing back. 

After performing some tests, I was able to replicate the multiple firing of the CellValidating event. I have updated the feedback item with a note to include this case as well. Unfortunately, the issue is at a location that is too deep for any customization to have an effect on it. Currently, the possible solution that I can suggest is to cancel the CellValidating event without using the TableAddNewRow.CancelAddNewRow method. Thus, you will be stuck in the invalid cell. If you press Escape, the new row will be rejected. Indeed, the event may be fired multiple times, but you can keep the last cell that triggered the event and if the last value is identical. In this case, you won't notify the user a second time for the invalid input.

We will do our best to introduce a fix as soon as possible.

I hope this information helps. If you have any additional questions, please let me know. 

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Pierre
Top achievements
Rank 1
answered on 07 Jan 2019, 10:35 AM
Hello,

Could we know at what point is the correction of this problem, it's already been a year and we are starting to need it quickly?

Thank you for your reply,

best regard
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Jan 2019, 12:47 PM
Hello, Pierre,   

The status of the feedback item indicates that a fix hasn't been introduced yet. Please allow me to explain how we prioritize the issues that our users report. We are taking into consideration the following key points:

• Is the reported issue a show-stopper;
• Does the reported issue have a work-around;
• What is the severity and nature of the issue (for example – memory leak issue, performance issue, functionality issue, styling issue);
• How many users have reported the issue / How many users have voted for a feedback item.

Since there is a workaround for the RadGridView editor issue that you experience and there are other issues which require more urgent fixes, your issue is still not addressed. If more customers vote for it, we will increase its priority.

Meanwhile, feel free to use the suggested workaround. Ensure that you follow the item. Thus, you will get notified once the item is changed.

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Pierre
Top achievements
Rank 1
answered on 09 Jan 2019, 05:10 PM

Hi,

The workaround is not good for us. I took the example of verification on a single column but it is on several columns that we must do the verification when the user must add a new line.

Thank's for your response

Best Regard

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Jan 2019, 07:20 AM
Hello, Pierre,        

The RowValidating event allows you validate the whole row. You can iterate all cells in the row element and determine whether to cancel the validation. Additional information how it works is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/editors/data-validation

Your question has already been answered in the support thread you have opened on the same topic. Please, see our answer there for more information.

I hope this information helps. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Dock
Asked by
Pierre
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Pierre
Top achievements
Rank 1
Share this question
or