Gridview Change Row to Readonly

Asked

Viewed 143 times

1

How can I change Row from a GridView to readonly? I need through values of one of the cells to allow or not editing of the line of GridView.

  • Give me more details, please. For example: What you have in Gridview lines; what kind of field you want to check to allow or not to edit. At what point are you willing to do this check. With more information you can reach a larger target audience to help you, rather than waiting for someone who will read these simple words and understand right away what you want.

1 answer

0


From what I understand of your question, if you find a value in any of the Cells Voce wants its line to become read only, so it follows something I had in mind:

VB:

 For RCnt As Integer = 0 To DataGridView1.Rows.Count - 1
    If DataGridView1.Rows(RCnt).Cells("SpecificCell").Value = "Something" Then
    DataGridView.Rows(RCnt).ReadOnly = True
    End If
    Next

C#

for (int RCnt = 0; RCnt <= DataGridView1.Rows.Count - 1; RCnt++) 
{
    if (DataGridView1.Rows(RCnt).Cells("SpecificCell").Value == "Something") 
    {
        DataGridView.Rows(RCnt).ReadOnly = true;
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.