call to javascript does not work

  • Thread starter Thread starter Beffmans
  • Start date Start date
B

Beffmans

Hi

i have a javascript on my webpage called CallPrint().
However when i trigger it from my asp.button it doesn't work and from my
anchor it does??

Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS1026: ) expected

Source Error:


Line 143: </TBODY>
Line 144:</TABLE>
Line 145:<asp:Button ID="but" Runat="server"
OnClick="javascript:CallPrint('divPrint');"></asp:Button>
Line 146:<a href="javascript:CallPrint 'divPrint');"> link</a>




ch B.
 
OnClick represents a server side onclick event. To setup a client side one
add it to the Attributes collection:
but.Attributes["onclick"]="CallPrint('divPrint')";

Line 146:<a href="javascript:CallPrint 'divPrint');"> link</a> is obviously
missing a "(".

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top