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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP:Button 2

Status
Not open for further replies.

dhmfh

Programmer
Nov 28, 2005
69
GB
Hi Guys

I have the following line of code:

<asp:Button ID="btnsubmit" CssClass="FormButton" Text="Submit" OnClick="ValidateQuoteRequest();" runat="server" />

The Onclick perform a JS function.

When I run this I get a compilation error says that 'ValidateQuoteRequest' is not a member of 'ASP.quoterequest_aspx'

Looked at examples and don't know why this doesn't run

Kind regards
 
it is trying to run a server side event called "ValidateQuoteRequest()"

If you want to add a client side click event use
Button1.Attributes.Add("onclick", "ValidateQuoteRequest();")

 
Hi jbenson001,

I have added the button1.attributes etc.. . Still receive the error

When I run this I get a compilation error says that 'ValidateQuoteRequest' is not a member of 'ASP.quoterequest_aspx'

Kind regards
 
OnClick is for a server side event. You'll want OnClientClick for a JS function.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
It depends on the version of .NET you are using. v1.x does not have "OnClientClick" as does v2.0. I believe either should work for you in v2.0

 
Also, did you define the function in <script> tags in the HTML of the page?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top