I'm tryign to hide my edit linkbutton on a from view if the user doesn't have edit rights to something. On page load I give them a grid view. When they select something I hide the grid view and make the formview visible. The below code is what I thought I would need but the only time I get it to go down to the myControl1.Visible = False line is after the formview is on the screen and the user clicks the button. How do I keep the button from showing up in the first place?
Protected Sub FormView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.Load
Dim myControl1 As Control
If CookieUtil.GetEncryptedCookieValue("edit") = "True" Then
myControl1 = FormView1.FindControl("Edit")
If (Not myControl1 Is Nothing) Then
myControl1.Visible = False