Re: How to pass special characters through query string ? by Bob
Bob
Tue May 20 06:13:02 CDT 2008
Sobin Thomas wrote:
> Hi All,
> I want to pass a string that contains many special characters (: \ . _
> etc) to another page in my website
> through query string.
> In my project I have a Gridview control ,in which there is a hyperlink
> field.The Gridview 's datasource is set as a database table at
> runtime.The hyperlink filed's DataNavigateUrlFields is set to
> "RecordID" ,which is a field in my database table.The RecordID field
> contains many special characters.I want to pass the RecordID to
> PlayRecord.aspx page .I transfer the RecordID by setting Hyperlink
> field's Data NavigateUrlFormat string as
> PlayRecord.aspx?RecID={0}.The problem is that, hyperlinks are not
> working as RecordID contains special characters.(It works if RecordID
> is a normal string).
The solution is the same for dotnet as it is for COM-based ASP: use the
urlEncode method to encode the strings being put into the querystring.
Having said that:
There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic (COM-based) asp newsgroup.
ASP.Net bears
very little resemblance to classic ASP so, while you may be lucky enough to
find a dotnet-knowledgeable person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"