Zaki Ahmad Sahri
Zaki Ahmad Sahri

Reputation: 37

ASP.NET GridView allow to edit certain row

Is there a way to allow editing of certain row instead of the whole row?

When I search a user it will fill data into the GridView. If I set the AutoGenerateEditButton to True, all the row will be editable. For example, if the GridView has 10 row, when the data in the row is between a certain criteria using If-else statement, I only want the bottom 5 to be editable instead of the whole 10 row.

Upvotes: 0

Views: 960

Answers (1)

Sruthi Suresh
Sruthi Suresh

Reputation: 697

try this..On gridviews row data bound event check the criteria ..

 protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
if ("Your Condition")
        {
           if ("your condition")
            {                
                e.Row.Enabled = true;//row is editable
            }
            else
            {
              e.Row.Enabled = false;//row is not editable
             }
          }
}

Upvotes: 1

Related Questions