Jump to content

ASP Buttons


turtle

Recommended Posts

I'm a XHTML and CSS veteran, but I'm new to ASP. I've inhertied a project where I need to add some code that triggers when the submit button of a form is clicked. The code for this button is:

<asp:Button ID="btnShortContact" runat="server" Text="Submit" ValidationGroup="vgShortContact" onclick="btnShortContact_Click1"/>

The output reads:

<input type="submit" name="ctl00$shortcontact1$btnShortContact" value="Submit" onclick="java script:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$shortcontact1$btnShortContact", "", true, "vgShortContact", "", false, false))" id="ctl00_shortcontact1_btnShortContact" />

I would like the output to be something like:

<input type="submit" name="ctl00$shortcontact1$btnShortContact" value="Submit" onclick="java script:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$shortcontact1$btnShortContact", "", true, "vgShortContact", "", false, false)); EXTRA CODE GOES HERE;" id="ctl00_shortcontact1_btnShortContact" />

I hope I haven't been too vague. Thank you.

Link to comment
Share on other sites

What do you want that extra script to do? The WebForm_DoPostBackWithOptions function already calls the submit() method for your form.If you want to add some javascript that runs when the form is submitted, you can try adding it to the form element:ASPX

<form id="myForm" runat="server" onsubmit="alert('this will alert when the form is submitted');">

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...