Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Javascript Error on a GridView templated column where data can contain single quote

Reply
Thread Tools

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

 
 
Anonieko
Guest
Posts: n/a
 
      04-08-2006
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,

 
Reply With Quote
 
 
 
 
OHM \( One Handed Man \)
Guest
Posts: n/a
 
      04-08-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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,
>



 
Reply With Quote
 
 
 
 
Anonieko
Guest
Posts: n/a
 
      04-10-2006
Thanks for the clues.

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

 
Reply With Quote
 
PeterDew PeterDew is offline
Junior Member
Join Date: Jul 2006
Posts: 1
 
      07-06-2006
Anonieko,

Do you generate your own javascript code somewhere in the events of the gridview ?
I had a similar problem when showing a special formatted tooltip for each row.
On each row I added an attribute 'onmouseover' and set the tooltip.
There I had to convert all single quotes with the HTML code "&apos;"

HTH
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with single-quote and double-quote when using subprocess. Evan Python 3 11-04-2008 12:24 PM
problem with quote and single-quote when using "subprocess" Evan Python 1 11-04-2008 12:08 AM
How to handling string contains single quote and double quote vikrant Perl Misc 8 05-17-2007 04:37 PM
Datagrid on load; replace all double single quote to single quote to display to user Eric Layman ASP .Net 3 04-14-2007 07:16 AM
Single Quote Versus Double Quote In A href link knee-dragger@hotmail.com HTML 3 06-13-2006 12:42 AM



Advertisments