LinkButton

  • Thread starter Thread starter Hugo Flores
  • Start date Start date
H

Hugo Flores

Hi,
I create a LinkButton in runtime, and I want to be able to
access a function when a user clicks on the generated link
in the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?
 
Hugo said:
Hi,
I create a LinkButton in runtime, and I want to be able to
access a function when a user clicks on the generated link
in the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?

AddHandler myLinkButton.Click, AddressOf myLinkButton_Click
 
After you create the object at runtime, use the AddHandler command.

AddHandler Button1.Click, AddressOf Button1_Click


Hope this helps,

Jurjen de Groot
G.I.T.S. Netherlands
 
As Jurjen pointed out, ADD HANDLER works,
OR - Create a page-level WITHEVENTS variable

in either case, be sure the dynamic control is created on all post-back
operations. If you don't, the event won't be trapped.

If you are referring to client-side (java script):

MyControl.Attributes.item("OnClick") = "return MyFunction();"

G.L.
 
Back
Top