Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: How to Add Link Button Programtically


Message #1 by "dHABUD" <dhabud@h...> on Tue, 8 Oct 2002 07:31:00
Hi

I am adding LinkButton to panel. I am adding this Link button in one of my 
Sub ROUTINEs instead of SUB Page_Load()

I am not able to set AddHandler for this Link Button.

Also If i create LinkButton in the form iteself rather than 
programatically, it does access the btnLink_Click SUB.

The code looks as follows

Function AddLinkButton()

 Dim lnkButton as New LinkButton()
 lnkButton.Text= "Click Here"
 AddHandler lnkButton.Click, AddressOf btnLink_Click
 panel1.Controls.Add(lnkButton)

end function

Sub btnLink_Click(obj as object, e as EventArgs)
 Response.Write("Clicked Link Button")
End Sub


Any Suggestion are greatly appreciated. 

Thanks In Advance
Dhabud

  Return to Index