Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 How to attach a onclick even to dynamically create

Author  Topic 

alpoor
Starting Member

29 Posts

Posted - 2005-06-20 : 17:29:38
I have dynamically created button on my page. I am wondering how I can attach a onlick event handler to the button
Any ideas or sample code please

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-20 : 19:36:41
this is in C#:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50862

here's more detail:

http://www.dotnetjohn.com/articles.aspx?articleid=62

and, as always consider Google or the help files that come with visual studio .net.



- Jeff
Go to Top of Page

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2005-06-20 : 22:57:05
Is this javascript?

function createButton()
{
var myNewButton = document.createElement("input");
myNewButton.type = "button";
myNewButton.value = "Your Button Text Goes Here";
myNewButton.id = "SomeID";
myNewButton.onclick = yourOnClickEventHandler;
someParentElement.appendChild(myNewButton);
}


Dustin Michaels
Go to Top of Page
   

- Advertisement -