473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to pass special characters through query string ?

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).
Hope you 'll surely have a solution.
Thanking you in advance for your reply.
Best Regards
Jun 27 '08 #1
5 11132
"Sobin Thomas" <so***@securesonic.comwrote in message
news:O5**************@TK2MSFTNGP03.phx.gbl...
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).
Hope you 'll surely have a solution.
Thanking you in advance for your reply.
This group is for Classic ASP. For ASP.NET questions post to
microsoft.public.dotnet.framework.aspnet
--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #2
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"
Jun 27 '08 #3
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ue**************@TK2MSFTNGP06.phx.gbl...
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.

How easy is that to achieve when databinding into a gridview? I don't use
the provided controls much myself. I suspect one would need to add a field
to the datasource that has the value UrlEncoded. Better would be to not use
such a value and use a numeric, hash or guid instead.

--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #4
Anthony Jones wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ue**************@TK2MSFTNGP06.phx.gbl...
>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.


How easy is that to achieve when databinding into a gridview? I
don't use the provided controls much myself.
I hadn't really thought it through. I suppose he would have to use a
templatefield object rather than a boundfield object so the object can
be bound to the result of the UrlEncode function.
I suspect one would
need to add a field to the datasource that has the value UrlEncoded.
That's one of the options I was thinking of.
Better would be to not use such a value and use a numeric, hash or
guid instead.
I can't argue with that.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 27 '08 #5

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ul**************@TK2MSFTNGP03.phx.gbl...
Anthony Jones wrote:
>"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ue**************@TK2MSFTNGP06.phx.gbl...
>>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.


How easy is that to achieve when databinding into a gridview? I
don't use the provided controls much myself.

I hadn't really thought it through. I suppose he would have to use a
templatefield object rather than a boundfield object so the object can
be bound to the result of the UrlEncode function.
Or you could simply format the value in the control's RowDataBound event....

--
Mike Brind
Microsoft MVP - ASP/ASP.NET
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
4
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am...
11
by: T O | last post by:
Hi all, I am very new to C programming and have come across problem. My programme has opened and created a text document on the hard drive. The document name is stored in a string called...
3
by: Jay | last post by:
Hello, I need to use Update Sql stmt from my page. Some of the field values has apostrophes and and quotes. How do I make ado.net ignore those characters? Eg- UPDATE ROOM SET HEIGHT='3'...
3
by: SMG - Idealake | last post by:
Hi All, I have created an application which is working fine and is in about to launch, now suddenly my mgmt says there are chances that Scrip ID( a particular id and not prim key) may have special...
17
by: Carl Mercier | last post by:
Hi, Is it possible to use special characters like \n or \t in a VB.NET string, just like in C#? My guess is NO, but maybe there's something I don't know. If it's not possible, does anybody...
6
by: TheRealDan | last post by:
Hi all. I'm having a problem with a special characters. I have php script that reads from an xml file and writes to a mysql db. It's a script called phptunest that I found on the net, although the...
0
by: dearsaran | last post by:
Hi, I Want a function written for finding the special characters in a emailid.. Suppose, i've a column email in a table and inserting a emailid with any of the special characters then if i...
13
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.