Click here to Skip to main content
14,699,089 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Hii ,

I am running javascript from my code behind by appending that script into my string builder . everything is fine , but for some reason multiply symbol after rendering into html is not get displayed

str.Append("var percent = Number(100 * value / total).toFixed(1);");


this is my statement ,... i tried many ways .. using @ symbol before sttement , double slashes , but nothing is rendring while html gets created for the script
Posted
Comments
upendra shahi 6-May-15 8:53am
   
give whole code..
Kornfeld Eliyahu Peter 6-May-15 8:55am
   
Can you show the part that displays the code as part of the html page?
ZurdoDev 6-May-15 8:56am
   
So what does get rendered?
   
What does it mean, "displayed"? Since when some JavaScript code is displayed somewhere?
—SA
Torakami 6-May-15 11:24am
   
Sorry for inconvenience , i was thinking that for some reason * mark is not get displayed . But when i debug the code completely .. in string builder in the middle , the * mark was replacning with blak and hence was the isssue ... Topic is closed .. thanks a lot for your quick replies .

1 solution

If I try that exact code:
StringBuilder sb = new StringBuilder();
sb.Append("function myFunction(value, total) {");
sb.Append("   var percent = Number(100 * value / total).toFixed(1);");
sb.Append("   return percent;");
sb.Append("}");
string s = sb.ToString();

What I get is exactly what I expect:
function myFunction(value, total) {   var percent = Number(100 * value / total).toFixed(1);   return percent;}

So you are either not doing something I am, or doing something I'm not!
How does mine differ from yours?
   
Comments
Torakami 6-May-15 11:26am
   
Yes , it should be .. but in my case the * marks was replacing with blank mark in the middle of the code and hence was the issue . i thouught at start for some reason , * marks was not rendering

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900