asp .net web control library + java script function?
I've got a web composite control library project and I would like to add a button which runs a java script function when it is clicked. i.e. "onclick"
I'm not sure where/how to add the java function block. A web user control file i.e. ascx allows you to view the HTML section to add script however for a web control library the file is of type .vb.
Any ideas?
Re: asp .net web control library + java script function?
This is how to add a onClick JS to a button.
In the Page load event:
VB Code:
If Not IsPostBack Then
btnClickMe.Attributes.Add("onClick", "alert('Woof!');return false")
End If
The return false on the end means that clicking the button does NOT cause a postback to the server and therefore the VB.NET button click event doesn't fire.
Woka