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

Row readonly

1 Answer 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Somnath
Top achievements
Rank 1
Somnath asked on 28 Mar 2011, 10:32 AM
HI

I have a Gridview with 5 columns one of them is  "Posted" column. it has 'Yes' or 'No'  ,only two possible values...
If value of a perticular row is 'Yes' for Posted column then the row should be readonly....

Let me know How can I achive this....

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 28 Mar 2011, 10:42 AM
Hi,

You can do this by cancelling the CellBeginEdit event if it meets your condition. For exmaple

private void RadGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    if (e.Row is GridViewDataRowInfo)
    {
        if (e.Row.Cells["Posted"].Value != null)
        {
            if (e.Row.Cells["Posted"].Value.ToString() == "Yes")
            {
                e.Cancel = true;
            }
        }
    }
}

Hope that helps but let me know if you have further questions
Richard
Tags
GridView
Asked by
Somnath
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or