Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute jscript function

Status
Not open for further replies.

bclt

Programmer
Mar 13, 2005
363
GR
Hi,

how can i execute a javascript function when i press a button ?

Notice that the button is System.Web.UI.WebControls.button, not an HTML button.



Tnx!
 

Only way I know of is in the code behind file like this example:

btnDelete.Attributes("OnClick")="return confirm('Are you sure your sure that your sure the you want to delete this?');
 
Code:
        Button1.Attributes.Add("onclick", "alert('hello');")

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
I saw this before a couple of minutes.
Tnx both!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top