Selected Row Read Only

3 posts, 0 answers
  1. Veda
    Veda avatar
    5 posts
    Member since:
    Jan 2013

    Posted 13 Feb 2013 Link to this post

    how  to make a particular row  in a grid view  as read only?

    How to make selected row read only true in telerik gridview?


    Thanks

    Vedanayagam G

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Feb 2013 Link to this post

    Hi,

    Try the following code to achieve your scenario.
    C#:

    void radGridView2_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        if (radGridView2.CurrentCell.IsSelected==true)
           {
                   radGridView2.CurrentCell.ColumnInfo.ReadOnly = true;
       }
    }

    Thanks,
    Shinu

  3. Stefan
    Admin
    Stefan avatar
    2416 posts
    Member since:
    Sep 2012

    Posted 15 Feb 2013 Link to this post

    Hello Veda,

    Thank you for writing.

    To make a particular row read only, you need to cancel its edit process. Here is an example:

    void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        if (e.Row.Cells["id"].Value.ToString() == 2)
        {
            e.Cancel = true;
        }
    }

    @Shinu - your code will make the current column read only, rather than a specific row.

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.

Back to Top