Here's my problem:
Different agencies are submitting projects to us, but I only want them to be able to edit their specific project (in addition, when they submit a project, they can only submit on behalf of their agency - but that may be a separate issue).
Anyway, I can use the codebehind to show/hide the edit/delete/details buttons based on whether or not the user is authenticated using the following simple code in the Page_Init event:
If User.Identity.IsAuthenticated Then
GridView1.Columns(0).Visible = True
GridView1.Columns(0).Visible = False
To get what I want, though, I need to check each row (RowDataBound Event?). The "SponsoringAgency" field will need to be validated against the user's credentials, and then the Edit button will be visible/invisible based on the result.
Here's what I don't know how to do:
1. When the user registers, have an additional field that asks and stores their agency information.
2. I can't quite figure out how to get the SponsoringAgency value from the gridview. I've tried a few tests using:
If e.Row.Cells(11).Text = "AgencyA" Then
e.Row.Cells(11).Text = "TEST"
This does not work - the text isn't changed. One of the possible problems is that I'm not sure I'm getting the right column in my grid
View Complete Post