Last post Aug 08, 2017 05:25 AM by Deepak Panchal
Aug 04, 2017 01:28 PM|washburn_it|LINK
I have a Gridview where I have to load some data read from an Oracle database.
In one of the columns there is the field "surname" that may contain the ASCII character 39 (single quote).
So how to replace the single quote?
I've tried this:
<asp:Label ID="lblCognome" runat="server" Text='<%# Bind("SURNAME").Replace("'","''") %>'></asp:Label>
but I get the error "tag server format not valid" (I translated the error message from italian so it may be different in english).
Aug 07, 2017 05:32 AM|Deepak Panchal|LINK
try something like mentioned below.
<asp:Label ID="lblDemo" runat="server"
text='<%# (DirectCast(Eval("NAME"), String).Replace("\'", ""))%>' >
Aug 07, 2017 07:17 AM|washburn_it|LINK
thanks for your suggestion, I tried with Text='<%# Eval("COGNOME").ToString().Replace("\'", "") %>'> but, again, I get the "tag server format not valid" error.
Aug 07, 2017 10:45 AM|washburn_it|LINK
I found the error.
It was not on the code of the page itself but on the query passed to the datasource of the grid.
I was able to correct it on the "codebehind" generated query and everything worked out.
Anyway...thanks for the suggestion.
Aug 08, 2017 05:25 AM|Deepak Panchal|LINK
I can see that your issue is solved now.
you had find the solution by yourself.
this thread is still open.
I suggest you to mark your own post as an answer.
it will help other community members in future , who will meet with the same issue like yours.