473,783 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DataNavigateUrl Fields 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 NavigateUrlForm at 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 11165
"Sobin Thomas" <so***@secureso nic.comwrote in message
news:O5******** ******@TK2MSFTN GP03.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 DataNavigateUrl Fields 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 NavigateUrlForm at 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.publi c.dotnet.framew ork.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 DataNavigateUrl Fields 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 NavigateUrlForm at 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.publi c.dotnet.framew ork.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******@NOyah oo.SPAMcomwrote in message
news:ue******** ******@TK2MSFTN GP06.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 DataNavigateUrl Fields 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 NavigateUrlForm at 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******@NOyah oo.SPAMcomwrote in message
news:ue******** ******@TK2MSFTN GP06.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 DataNavigateUrl Fields 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 NavigateUrlForm at string as
PlayRecord.as px?RecID={0}.Th e 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******@NOyah oo.SPAMcomwrote in message
news:ul******** ******@TK2MSFTN GP03.phx.gbl...
Anthony Jones wrote:
>"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcomwrote in message
news:ue******* *******@TK2MSFT NGP06.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 DataNavigateUrl Fields 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 NavigateUrlForm at string as
PlayRecord.a spx?RecID={0}.T he 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
14045
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 some characters. Can you please kindly share the code segment to workaround how to pass such a long string value to a asp page. This is how I invoke the test page:
4
5266
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 having trouble preserving data as it gets entered into the database. Primarily, quotes and special characters. Spcifically, I noticed it stripped out some double quotes and a "Registered" symbol &reg; (not the ascii but the actual character"
11
8353
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 "output". At the end of the program, I want to open the outputfile.txt automatically using notepad.
3
1954
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' - 5"' WHERE RMNU='100'
3
651
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 characters like '&,*,) or /' This data(field/key) I am passing this value as a querystring. e.g. value to be passed : ABC http://localhost/myProj/abc.aspx?ScripID=ABC
17
30673
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 know of a VB.NET function (somebody must have coded this already) that will interpret strings containings those special characters, and handle them the same as in C#?
6
3879
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 original website for the author appears to be gone. It works really nicely except when it hits special characters. Everything from a sp char forward just gets lost. It is using mysql_real_escape_string, but that doesn't seem to help with the ...
0
1712
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 compile the funtion then it should show the wrong emailid's Example: If a emailid is dear#$saran@gmail!#$%.com then 1st it should check any special char from 1st letter to '@' and one more condition is after @ is there any sepcial char(even space is...
13
3736
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 !! And !! Not sure how to do so (should it be a query in Access or a macro) The connection would be ODBC.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.