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

Readonly Property to Row of Gridview

2 Answers 284 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vidhya
Top achievements
Rank 1
Vidhya asked on 29 Oct 2010, 12:39 PM
hi..

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

2 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 29 Oct 2010, 02:02 PM
Hello,

There is not and there should not be a default way to do that, the read only property is usually applied to the column, not the row.

But there is a way, let's say you define a few conditions that decide if a row is read only or not (for example has a specific value, has a certain rowindex, or anything else).

After this, you can just handle the CellBeginEdit event, and perform the required checks on the CurrentCell.RowInfo.
If it matches the conditions provided and so the row should be read only you can just use:
void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    var rowInfo = radGridView1.CurrentCell.RowInfo;
    // if ()
    e.Cancel = true;
}

Hope this helps, if you have any other questions or comments, please let

me know,

Best Regards,
Emanuel Varga
0
Vidhya
Top achievements
Rank 1
answered on 30 Oct 2010, 05:26 AM
Thank you....
its working correctly...
Tags
GridView
Asked by
Vidhya
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Vidhya
Top achievements
Rank 1
Share this question
or