' in a datagrid

  • Thread starter Thread starter martin
  • Start date Start date
M

martin

Hi,

I have a datgrid that takes information fro a database and displays it.
This is working fine, except recently a piece of data was placed in the
database that contains an apostrophe (')

Now the datagrid is still displayed correctly except thi has cauesd a
javascript error on the page.
I am wondering how to get around this, I don't want to replace ' with \n .
while this will be ok in the javascript my name will be displayed in the
datagrid with a \n before the apostrophe.

I am not sure if there is a special character for a '.
even if there is the value is stored in the database with an apostrophe, so
everytime I take it out I will have to change the apostrophe to a special
character and everytime I put it back in I will have to replace the special
character with a '.

Is there a function that will simpled "encode" m name so that characters suc
as ' will not cause a problem for javascript but will still display properly
on the page.

many thanks in advance.

cheers

martin.
 
Thank you but HTMLEncode does not alter a '

I have found the answer, user " " to surrounf the javascript and not ' '
cheers

martin.
 
Back
Top