radgridview rowvalidating event index

2 posts, 0 answers
  1. Alberto
    Alberto avatar
    1 posts
    Member since:
    Dec 2011

    Posted 06 Dec 2012 Link to this post

      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?

  2. Svett
    Svett avatar
    728 posts

    Posted 11 Dec 2012 Link to this post

    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,
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top