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

RowValidating event missing?

4 Answers 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 23 Oct 2008, 05:08 PM
Hi, I have noticed there are a lot of missing events for the RadGridView such as RowValidating.  Do you know how I can implement this event?  I ask this because when I add a new row, I don't want the user to add another one until correct data is entered.

Thanks,
Derek.

4 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 27 Oct 2008, 11:26 AM
Hello Derek,

Thank you for contacting us.

If you add a new row externally - through other controls - you may also implement validation externally.

If you are using "Click here to add new row", a new row is inserted immediately upon click which is an empty one - contains no data. So, to use validation (regardless whether it applies to a newly inserted row or an existing one), please review the following code snippet (ValueChanging event):

private void radGridView1_ValueChanging(object sender, ValueChangingEventArgs e)  
{  
    if (this.radGridView1.CurrentCell.ColumnIndex == 0) {//applies to the 1st column  
           if (something ) { //use e.NewValue, e.OldValue for validation  
                                    
                e.Cancel = true//keep the oldvalue by canceling the event
           }  
    }   

I hope that helps. Do not hesitate to contact me back if you have further questions.

All the best,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Derek
Top achievements
Rank 1
answered on 29 Oct 2008, 01:40 PM
Hi thanks for that, but my problem is this:

I don't use 'click here to add new row' I click the '+' button. This is fine, a new row is inserted, but when I try to move off that row it attempts to save the row and comes back with an error saying that one of my columns cannot be null. ValueChanging event doesn't seem to help in this regard.

Thanks for all your help,
Derek.
0
Nick
Telerik team
answered on 31 Oct 2008, 06:48 PM
Hi Derek,

Thank you for the additional details. It seems that you have stumbled upon a case in our Grid control, which we have not addressed. Unfortunately, I cannot provide you with a fix or a workaround for the issue at the moment.

Sorry for the introduced inconvenience. We will try to fix it as soon as possible.

 
Greetings,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Derek
Top achievements
Rank 1
answered on 03 Nov 2008, 10:46 AM
ok thanks
Tags
GridView
Asked by
Derek
Top achievements
Rank 1
Answers by
Nick
Telerik team
Derek
Top achievements
Rank 1
Share this question
or