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

radgridview rowvalidating event index

1 Answer 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alberto
Top achievements
Rank 1
Alberto asked on 07 Dec 2012, 05:01 AM
Hello,
  Im using telerik 2010.2.10.713 version library, i want on my radgridview to validate the filled fields by the user at the end of editing the row, i have as selection mode the fullrow select, for that purpose i used row validating event wich i used on datagridview but this didnt work on radgrid view, im trying:

if (radGridView1.Rows[e.RowIndex].Cells["usu_clave"].Value == null)              {                    radGridView1..Rows[e.RowIndex].Cells["usu_clave"].ErrorText ="some error";               e.Cancel = true;     //prevent the user to save changes                       return;             }


<code style="color: #000;">if (radGridView1.Rows[e.RowIndex].Cells["usu_clave"].Value == null)</code><code style="color: #069;font-weight: bold;"></code><code style="color: #000;">              {</code><code style="color: #000;">                    radGridView1..Rows[e.RowIndex].Cells["usu_clave"].ErrorText ="some error";</code><code style="color: #069;font-weight: bold;"></code><code style="color: #000;">               e.Cancel = true;     //prevent the user to save changes      </code><code style="color: #069;font-weight: bold;"></code><code style="color: #000;">                 return;</code><code style="color: #069;font-weight: bold;"></code>             }<br><div style=" background-color: #fff;"><span style=" "><span style=" margin-left: 0px !important;"><code style="color: #000;"></code></span></span></div>

what is going wrong?

thanks!

1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 11 Dec 2012, 04:57 PM
Hi Alberto,

I am not able to assist you efficiently by following the supplied information. I assume that the issue is caused by the fact that you are using RowIndex in cooperation with the Rows collection when the RadGridView is filtered, sorted or grouped. In that case, you should use the ChildRows collection instead. In addition, I recommend using e.Row instead of e.RowIndex as it is the quicker API to employ. If these guidelines do not help you resolve the issue, I would kindly ask you to share with us a sample code snippet which demonstrates how you initialize and use RadGridView.

Kind regards,
Svett
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
General Discussions
Asked by
Alberto
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or