What is "My quotes"?
How to pass special characters through query string ?
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > ASP web-programming > How to pass special characters through query string ? 21 May 2008 17:22:45

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

How to pass special characters through query string ?

Sobin Thomas 21 May 2008 17:22:45
 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 DataNavigateUrlFiel­ds 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?Rec­ID={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


Add comment
Anthony Jones 20 May 2008 11:09:36 permanent link ]
 "Sobin Thomas" <sobin@securesonic.­com> wrote in message
news:O59TnFkuIHA.45­60@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 DataNavigateUrlFiel­ds 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?Rec­ID={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.do­tnet.framework.aspne­t


--
Anthony Jones - MVP ASP/ASP.NET


Add comment
Bob Barrows 20 May 2008 15:13:02 permanent link ]
 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 DataNavigateUrlFiel­ds 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?Rec­ID={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-knowledgeabl­e person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeabl­e people hang out. I suggest
microsoft.public.do­tnet.framework.aspne­t 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"


Add comment
Anthony Jones 20 May 2008 23:53:29 permanent link ]
 "Bob Barrows [MVP]" <reb01501@NOyahoo.S­PAMcom> wrote in message
news:uewWypmuIHA.13­16@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 DataNavigateUrlFiel­ds 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?Rec­ID={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


Add comment
Bob Barrows 21 May 2008 00:18:19 permanent link ]
 Anthony Jones wrote:
"Bob Barrows [MVP]" <reb01501@NOyahoo.S­PAMcom> wrote in message
news:uewWypmuIHA.13­16@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 DataNavigateUrlFiel­ds 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?Rec­ID={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.


Add comment
Mike Brind 21 May 2008 17:22:45 permanent link ]
 
"Bob Barrows [MVP]" <reb01501@NOyahoo.S­PAMcom> wrote in message
news:ulPPmaruIHA.37­80@TK2MSFTNGP03.phx.­gbl...
Anthony Jones wrote:
"Bob Barrows [MVP]" <reb01501@NOyahoo.S­PAMcom> wrote in message
news:uewWypmuIHA.13­16@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 DataNavigateUrlFiel­ds 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?Rec­ID={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


Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > ASP web-programming > How to pass special characters through query string ? 21 May 2008 17:22:45

see also:
patch to avoid loops in htdig indexing
error message numbers
RE: ssl + apache
пройди тесты:
see also:
How to Convert DRM protected M4P iTunes…
How to Transfer iTunes M4P Songs to…
Business Portal Promotion

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .