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

RowValidating firing on load for new add line

3 Answers 170 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ruth Goldberg
Top achievements
Rank 1
Ruth Goldberg asked on 24 Feb 2010, 01:37 PM
This appears to be a bug. There is no purpose in the RowValidating during form load, before anything has been entered, and it really messed me up. My row validation checks for required fields. The empty add line will never have any of the required fields, so it will always fail. At that point, I'm stuck on the add line and can't edit or delete any other row. I've gotten around it by skipping row validation on its first call for a new record, but I'm not sure this will entirely solve the problem. What property tells me this is an empty add row?

3 Answers, 1 is accepted

Sort by
-1
Jack
Telerik team
answered on 25 Feb 2010, 07:42 AM
Hello Ruth Goldberg,

You could check the row type when handling RowValidating event. For this purpose use the Row property of the event arguments. When it is validating the new row this property will be of type GridViewNewRowInfo. I hope this helps. I will be able to be more precise in my suggestion if you send me your application.

RowValidating
fires when setting the DataSource to synchronize the current row with the currency manager. You can skip this step by attaching to the event after setting the DataSource property.

Should you have other questions, please write back.

Best wishes,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
1
Ruth Goldberg
Top achievements
Rank 1
answered on 25 Feb 2010, 01:28 PM
I'm already checking the row type, but I do validating on new rows also. I want to know how I can tell the row is empty and never had any text typed into it. What property or properties will tell me that. My program is in vb.net, not C#, so I don't have to attach to events.
0
Jack
Telerik team
answered on 26 Feb 2010, 07:44 AM
Hi Ruth Goldberg,

I understand; interesting scenario. You could use the Tag property of the row to save the information whether the row is edited or not. Another approach is to iterate all cells and check whether their value is different from DBNull. Please, could you send me your application. This way I will be able to give more precise suggestions. I am looking forward to your project.

All the best,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Ruth Goldberg
Top achievements
Rank 1
Answers by
Jack
Telerik team
Ruth Goldberg
Top achievements
Rank 1
Share this question
or