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

How to update only a few rows

3 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fernan
Top achievements
Rank 1
Fernan asked on 29 Jun 2011, 04:24 PM
Hi,

I have a grid to users on muy web applicattion. I want to update all users except admin user.

I want the row which is Admin user, this row can't to be updated.

¿How to ?

Thanks,

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Jun 2011, 05:14 AM
Hello Ferman,
Try the following code snippet in the ItemDataBound to hide the edit button based on the user name.
C#:
if (dataItem["UserName"].Text != "Addmin")
  {
    LinkButton linkButton = (LinkButton)dataItem["EditCommandColumn"].Controls[0];
    linkButton.Enabled = false;
   }

Also check out the following help documentation.
Setting edit permissions depending on permission field.

Thanks,
Shinu.
0
Fernan
Top achievements
Rank 1
answered on 30 Jun 2011, 11:16 AM
Hi,

Thanks, but it isn't working.

dataItem["EditCommandColumn"] is always null. I have AutoGenerateEditColumn="true".

thanks,

0
Princy
Top achievements
Rank 2
answered on 30 Jun 2011, 11:27 AM
Hello Ferman,

If you are using autogenerated edit column, try accessing the column with its UniqueName as AutoGeneratedEditColumn

C#:
if (dataItem["EmployeeID"].Text != "Admin")
 {
     LinkButton linkButton = (LinkButton)dataItem["AutoGeneratedEditColumn"].Controls[0];
     linkButton.Enabled = false;
}

Thanks,
Princy.
Tags
Grid
Asked by
Fernan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Fernan
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or