I would like to show different values in a dropdownlist, while editing a gridview, depending on which user is logged in. For example...
The officer would see "Approved by Officer" status. The director would see "Approved by Director" status
I am trying to add these programatically to a dropdownlist which I have in the edit template of my gridview (approvalsGrid). Here is my code:
Protected Sub ApprovalsGrid_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles ApprovalsGrid.RowUpdating
Dim ApprovalEditDD As DropDownList = CType(ApprovalsGrid.Rows(ApprovalsGrid.EditIndex).FindControl("ApprovalEdit"), DropDownList)
If User.Identity.Name = "officer" Then
ApprovalEditDD.Items.Add("Approved by Officer")
End If
End Sub
I do not get any errors. But get an empty dropdown with no items. Am I using the correct event?