apostrophes or quotes creating problem while passing to javascript
-
Hi all, I am passing values from my datagrid to client side javascript function. In that some of the values contains apostrophes or quotes, which is creating error.I guess, this is because of values passed to browser are in ' ' quotes, and it encounter an apostrophes or quotes, that creates an error. Anybody have some solution of this problem? Please let me know. Thank you very much, NIKI
-
Hi all, I am passing values from my datagrid to client side javascript function. In that some of the values contains apostrophes or quotes, which is creating error.I guess, this is because of values passed to browser are in ' ' quotes, and it encounter an apostrophes or quotes, that creates an error. Anybody have some solution of this problem? Please let me know. Thank you very much, NIKI
Try running the values through System.Web.HttpUtility.HtmlEncode()
-
Hi all, I am passing values from my datagrid to client side javascript function. In that some of the values contains apostrophes or quotes, which is creating error.I guess, this is because of values passed to browser are in ' ' quotes, and it encounter an apostrophes or quotes, that creates an error. Anybody have some solution of this problem? Please let me know. Thank you very much, NIKI
-
Try running the values through System.Web.HttpUtility.HtmlEncode()
-
Try running the values through System.Web.HttpUtility.HtmlEncode()
I have the same problem too. I am a student at BBU in Cambodia. In major: Information Technology. This web is so interested.
-
Encode the string correctly to be a string value in Javascript: theString = theString.Replace("\\", "\\\\").Replace("'", "\\'"); --- b { font-weight: normal; }
Hi Guffa, I have a line in javascript function like this: function myfunction(value1) { document.GetElementById('td').innertext=value1; } how can i parse the value1 field which contain apostrophes, such a way that it will not create problem while passing to the javascript function from server datagrid. and also, i dont want to eliminate apostrophes from the output on client side. Thanks, NIKI
-
Hi Guffa, I have a line in javascript function like this: function myfunction(value1) { document.GetElementById('td').innertext=value1; } how can i parse the value1 field which contain apostrophes, such a way that it will not create problem while passing to the javascript function from server datagrid. and also, i dont want to eliminate apostrophes from the output on client side. Thanks, NIKI
-
You do as I showed when creating the code that calls that function. --- b { font-weight: normal; }