How to make a link button visible after clicking another button in asp.net (vb) in button_click ()

How to make a link button visible after clicking another button in asp.net (vb) in button_click ()

it talks about the error as "Object reference not set to object instance".

I did this in my code

Protected Sub InsertButton_Click (Sender ByVal As Object, ByVal e As System.EventArgs)

    Dim receipt As LinkButton = FormView1.FindControl("LinkButton1")

   ' receipt.Enabled = "true"
   ' receipt.EnableTheming = "true"
   ' receipt.EnableViewState = "true"
    receipt.Visible = "true"

      

End Sub

+2


a source to share


2 answers


Remove the form name as follows:



Dim receipt As LinkButton = FindControl("LinkButton1")
If (Not receipt Is Nothing)
   ' receipt.Enabled = "true"
   ' receipt.EnableTheming = "true"
   ' receipt.EnableViewState = "true"
    receipt.Visible = "true"
End if

      

+1


a source


Or like this ...



    LinkButton1.Visible = "true"

      

0


a source







All Articles