469,913 Members | 1,947 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

Too many characters in character literal - what does it mean, and how to fix?

17
Hello,

I have a bunch of Image Buttons in my code. When I leave them as they are, I can build my project without problems. However, when I add OnClick to an image button, I get the error:
Too many characters in character literal

For example, the following builds with no problems:
Expand|Select|Wrap|Line Numbers
  1. <asp:imagebutton id="myImgBtn" style="Z-INDEX: 102; LEFT: 82px; POSITION: absolute; TOP: 8px" runat="server" ImageUrl="images/myBtns/order.gif" BorderStyle="None" ToolTip="Order"></asp:imagebutton>
  2.  
That same line, with OnClick added, does not build, and I get the above mentioned error:
Expand|Select|Wrap|Line Numbers
  1. <asp:imagebutton id="myImgBtn" style="Z-INDEX: 102; LEFT: 82px; POSITION: absolute; TOP: 8px" runat="server" ImageUrl="images/myBtns/order.gif" BorderStyle="None" ToolTip="Order" OnClick="dcsMultiTrack('DCS.dcsuri','/ordering/orderbtn', 'WT.ti','Order')"></asp:imagebutton>
  2.  
How can I fix this? I'm trying to add the OnClick code in order to keep stats of button presses (we use webtrends).
Why exactly is that error happening?

I googled for a solution, and found that I could add an attribute to the button in my C# code. However, I was wondering if I can do this straight in asp without resorting to changing the C# code. Oh, this happens with Visual Studio 2005. My machine has the following .Net frameworks: 1.1, 2.0, 2.0 SP2, 3.0 SP2, 3.5 SP1 (also 2.0 SDK and 1.1 SDK)

Thanks for any help.
Dec 19 '08 #1
2 13985
Curtis Rutland
3,256 Expert 2GB
Are you trying to use a Javascript when you click the imagebutton?

OnClick is a server side event. If you want your client side scripting to catch the event, you want to use OnClientClick.
Dec 19 '08 #2
Plater
7,872 Expert 4TB
@insertAlias
I didn't even catch that, nice one
Dec 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by wintaki | last post: by
3 posts views Thread by Eranga | last post: by
9 posts views Thread by VJ | last post: by
15 posts views Thread by pkaeowic | last post: by
6 posts views Thread by =?ISO-8859-2?Q?Boris_Du=B9ek?= | last post: by
1 post views Thread by Monica Pnade | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.