469,642 Members | 1,230 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Javascript Error on a GridView templated column where data can contain single quote

Hello ASPNET guru's,

What is a clean way to go around the problem of displaying a GridView
templated column where data can contain Single Quote ( ' )?

I maybe too naive, but this is of course a common scenario.

Scenario:

* My database returns names that can contain single quote.
* For example: O'byran, D'Ottwa, Osan's , and so on.
* I use a Gridview to view the data ( ASPNET 2.0 RTM)
* If that GridView column is a Bound Column. NO PROBLEM.
* If you convert that column into a Templated Column, error on
javascript on runtime.
Right now, I just remedy this by going to the database SELECT
statement (or stored proc) and removing the single quote. But what is
the real solution here?

Thanks,

Apr 8 '06 #1
2 1983
First of all this should not normally be a problem, we do this all the time
with single quotes in template fields and dont experience any javascript
errors.

1.) How and what are you binding your gridview to ?
2.) At what point is the javascript error occuring and what code is failing
( Post it )
3.) Is there any code you are running specific to the textboxes or whatever
controls you are using ?

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"Anonieko" <an******@hotmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello ASPNET guru's,

What is a clean way to go around the problem of displaying a GridView
templated column where data can contain Single Quote ( ' )?

I maybe too naive, but this is of course a common scenario.

Scenario:

* My database returns names that can contain single quote.
* For example: O'byran, D'Ottwa, Osan's , and so on.
* I use a Gridview to view the data ( ASPNET 2.0 RTM)
* If that GridView column is a Bound Column. NO PROBLEM.
* If you convert that column into a Templated Column, error on
javascript on runtime.
Right now, I just remedy this by going to the database SELECT
statement (or stored proc) and removing the single quote. But what is
the real solution here?

Thanks,

Apr 8 '06 #2
Thanks for the clues.

The problem is not on the template but on a javascript error in the
page.

Apr 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by hammad.awan_nospam | last post: by
reply views Thread by Mike N | last post: by
4 posts views Thread by Chris Davoli | last post: by
3 posts views Thread by Gunawan | last post: by
1 post views Thread by =?Utf-8?B?UGF0cmljayBG?= | last post: by
4 posts views Thread by Mark Olbert | last post: by
1 post views Thread by savajx1 | last post: by
25 posts views Thread by Blasting Cap | last post: by
10 posts views Thread by gnewsgroup | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.