To add a server-side event handler, use the following code:
MyButton.Click += new System.EventHan dler(MyButton_C lick)
where MyButton_Click is as follows:
private void MyButton_Click (object sender, System.EventArg s e)
{
// Your button click code here.
}
If you want to do something client-side in the onClick event, use:
myButton.Attrib utes.Add("onCli ck", "fnClientSideTh ing()");
This code will fire the client-side javascript function called
fnClientSideThi ng() when the button is clicked.
Hope this helps,
Mun
"anony" <no**@m.com> wrote in message
news:Xt******** ************@tw ister.tampabay. rr.com...
Hi,
I'm trying to dynamically add a button to my ASP.NET / VB page. I can't
seem to figure out how to add a routine to the OnClick event. Any insight
would be greatly appreciated!
Thanks,
Brian