Error Cs1012 Too Many Characters In Character Literal Javascript
Contents |
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/General ASP.NET/HTML, CSS and JavaScript/Too many characters in
Error 1 Too Many Characters In Character Literal
character literal in javascript!!! Too many characters in character error 1 too many characters in character literal c# literal in javascript!!! [Answered]RSS 9 replies Last post Oct 24, 2007 12:09 AM by duynnh
Too Many Characters In Character Literal Jquery
‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Reply duynnh Member too many characters in character literal c# asp net 23 Points 196 Posts Too many characters in character literal in javascript!!! Oct 23, 2007 06:31 AM|duynnh|LINK Hi All: I have code: string MyCust_Code = e.Row.Cells.FromKey("CusCode").ToString(); e.Row.Cells.FromKey("CusName").Value = "" + e.Row.Cells.FromKey("CusName").ToString() + ""; And PopupCampaign_Test Javascript function: function PopupCampaign_Test(stringrequest) { mywindow = window.open('../LGPopup/SearchCampaignReload.aspx?MyCus_Code='+stringrequest+'','','width=750,height=480,status=yes,scrollbars=no,resizable=no,menubar=no;toolbar=no,titlebar=no'); mywindow.moveTo(345, 120); } But this is Error: "Too many characters in character literal " How Can change it to solve this problem??? THanks Reply triggered Contributor 2255 Points 1043 Posts Re: Too many characters in character literal in javascript!!! Oct 23, 2007 10:46 AM|triggered|LINK You have quotes or a apostrophe in the literal text you are writing into your javascript. They need to be escaped or htmlencoded as entities. For instance, " Reply NC01 All-Star 40650 Points 15353 Posts Re: Too many characters in character literal in javascript!!! Oct 23, 2007 10:56 AM|NC01|LINK This looks like a duplicate post to this: http://forums.asp.net/t/1173112.aspx NC... Reply duynnh Member 23 Points 196 Posts Re: Too many characters in character literal in javascript!!! Oct 23, 2007 11:33 AM|duynnh|LINK Hi NC01 !!! Can you help me solve this problem with this codes. Please h
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Too many characters in character literal asp.net up vote 1 down vote favorite 1 I am getting http://forums.asp.net/t/1173161.aspx?Too+many+characters+in+character+literal+in+javascript+ a following error "Too many characters in character literal" when I try to run a javascript location.href during the onclick of the button.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of http://stackoverflow.com/questions/20600191/why-im-getting-cs1012-too-many-characters-in-character-literal-and-cs0019 this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign too many up Why I'm getting CS1012: “Too many characters in character literal” and CS0019? up vote 15 down vote favorite When trying to upload something to Imgur, I have to put an Authorization in. I do it with WebRequest.Headers but it gives me three errors. 2 times CS1012 error Too many characters in character literal and 1 time CS0019 error: Operator '+' cannot be too many characters applied to operands of type 'char' and 'method group' This is the code: webRequest.Headers['Authorization'] = 'Bearer ' + GetToken; What have I done wrong, how can I fix it, and how does it work? This is uploading with Imgur, I don't know if the 'GetToken' thing is right but it's to get the AccessToken, which should work correctly if I'm right. c# imgur share|improve this question edited Dec 15 '13 at 21:55 Alexei Levenkov 71.1k55398 asked Dec 15 '13 at 21:45 Stepepper 3581616 add a comment| 1 Answer 1 active oldest votes up vote 47 down vote accepted You're trying to use single quotes for string literals - that's invalid in C#. Single quotes are for character literals (char). You need double quotes for string literals. You also need parentheses for a method call: webRequest.Headers["Authorization"] = "Bearer " + GetToken(); (Note that this has nothing to do with imgur or WebRequest - it's just normal C#.) Links to MSDN explanations with samples: CS1012 - "Too many characters in character literal" CS0019 - "Operator 'operator' cannot be applied to operands of type 'type' and 'type'" share|improve this answe