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

Selected Row Read Only

2 Answers 418 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Veda
Top achievements
Rank 1
Veda asked on 13 Feb 2013, 06:52 AM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Feb 2013, 06:49 AM
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
0
Stefan
Telerik team
answered on 15 Feb 2013, 02:07 PM
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.
Tags
GridView
Asked by
Veda
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Stefan
Telerik team
Share this question
or