Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with an apostrophe in a query string

Status
Not open for further replies.

iRead

Programmer
Joined
Mar 12, 2004
Messages
25
Location
US
In my application I have the user click on a row in a data grid to drilldown to the detailed data then displayed on the resulting page. I use this line in the datagrid to make this happen.

<a style="COLOR: black; TEXT-DECORATION: none" href='TestList.aspx?Res=1&Type=Desc&Name=
<%# ((DataRowView)Container.DataItem)["Description"]%>'>
<%# ((DataRowView)Container.DataItem)["Description"]%>
</a>

Everything works fine and I get the results I want until the variable passed from the C# code behind passes a variable with an apostrophe in it. For instance when ((DataRowView)Container.DataItem)[“Description”] returns Brewmister’s Ale it it build the query string as:

“http:/ Brewmister”

instead of

“http:/ Brewmister’s Ale”

Any suggestions will be greatly appreciated.

Thank You,
iRead
 
I'd try to Server.UrlEncode() the string.
 
I’ll investigate that.

Thank you,
iRead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top