Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 11, 2012 05:17 AM by raju dasa
Member
705 Points
624 Posts
Dec 08, 2012 02:07 PM|LINK
I am using this statement to invoke the javascript and removing the single quote escape character from the values that I am passing to javascript function.
<label style="text-decoration: underline" onclick="javascript:GetSelectedRow('<%# Eval("ID") %>','<%# Eval("systempath").ToString().Replace("'", @"\'"); %>','','',1);"><%#Eval("ID") %></label>
how can I modify the above line so that it also removes the double quotes and single quotes together.
any help will be appreciated.
All-Star
20143 Points
3327 Posts
Dec 08, 2012 07:32 PM|LINK
Hi,
Instead of removing this stuff at client side, you can do that in the server side!
Anyway, check the below code -
<label style="text-decoration: underline" onclick="javascript:GetSelectedRow('<%# Eval("ID") %>','<%# Eval("systempath").ToString().Replace("'", @"\'").Replace("\"", @"\""); %>','','',1);"><%#Eval("ID") %></label>
Hope it helps u...
Dec 10, 2012 04:21 PM|LINK
I am getting error with the above replace statement.
Dec 10, 2012 06:22 PM|LINK
I tried this in code behind
private String _systemPath; public String SystemPath { get { // return _systemPath = _systemPath.Replace("'", "\'").Replace("\"", @"\\\""); return _systemPath = _systemPath.Replace("'", @"\'").Replace(@"\""", "\""); } set { _systemPath = value; } }
none of them are working. any help will be gretly appreciated. I need to put backlash to handle both double quotes and single quotes
Star
14362 Points
2441 Posts
Dec 11, 2012 05:17 AM|LINK
Hi, try these alternatives: http://stackoverflow.com/questions/264414/how-to-use-single-quotes-in-eval-format-string or using String.Format: http://stackoverflow.com/questions/5649485/using-if-with-eval-in-asp-net
anjaliagarwa...
Member
705 Points
624 Posts
applying escape charater in javascript function
Dec 08, 2012 02:07 PM|LINK
I am using this statement to invoke the javascript and removing the single quote escape character from the values that I am passing to javascript function.
<label style="text-decoration: underline" onclick="javascript:GetSelectedRow('<%# Eval("ID") %>','<%# Eval("systempath").ToString().Replace("'", @"\'"); %>','','',1);"><%#Eval("ID") %></label>how can I modify the above line so that it also removes the double quotes and single quotes together.
any help will be appreciated.
roopeshreddy
All-Star
20143 Points
3327 Posts
Re: applying escape charater in javascript function
Dec 08, 2012 07:32 PM|LINK
Hi,
Instead of removing this stuff at client side, you can do that in the server side!
Anyway, check the below code -
<label style="text-decoration: underline" onclick="javascript:GetSelectedRow('<%# Eval("ID") %>','<%# Eval("systempath").ToString().Replace("'", @"\'").Replace("\"", @"\""); %>','','',1);"><%#Eval("ID") %></label>Hope it helps u...
Roopesh Reddy C
Roopesh's Space
anjaliagarwa...
Member
705 Points
624 Posts
Re: applying escape charater in javascript function
Dec 10, 2012 04:21 PM|LINK
I am getting error with the above replace statement.
anjaliagarwa...
Member
705 Points
624 Posts
Re: applying escape charater in javascript function
Dec 10, 2012 06:22 PM|LINK
I tried this in code behind
private String _systemPath; public String SystemPath { get { // return _systemPath = _systemPath.Replace("'", "\'").Replace("\"", @"\\\""); return _systemPath = _systemPath.Replace("'", @"\'").Replace(@"\""", "\""); } set { _systemPath = value; } }none of them are working. any help will be gretly appreciated. I need to put backlash to handle both double quotes and single quotes
raju dasa
Star
14362 Points
2441 Posts
Re: applying escape charater in javascript function
Dec 11, 2012 05:17 AM|LINK
Hi,
try these alternatives:
http://stackoverflow.com/questions/264414/how-to-use-single-quotes-in-eval-format-string
or using String.Format:
http://stackoverflow.com/questions/5649485/using-if-with-eval-in-asp-net
rajudasa.blogspot.com || blog@opera