Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Datalist control problem with hyperlink (http://www.velocityreviews.com/forums/t780212-datalist-control-problem-with-hyperlink.html)

mister-Ed 09-19-2007 11:33 PM

Datalist control problem with hyperlink
 
I am displaying subcategories in my datalist, and now I have a
bizarre thing happen when I add a new subcategory record in my sql
database, the new subcategory link does not click into the next page.
When clicking the link, nothing happens!:

code to link w/querystrings formatted:
<a href="prov-results1.aspx?county=<
%#Server.UrlEncode(Request.QueryString("county")) & "&subcat=" &
Server.UrlEncode((Eval("SubCategory").ToString())) & "&category=" &
Server.UrlEncode((Eval("Category").ToString())) & "&uregion=" &
Server.UrlEncode((Eval("uregion").ToString()))%>"> <%#
Eval("SubCategory")%></a>


url generated for working link:
http://www.lasvegasunions.info/prov-...y=Clark&subcat...


a subcat link that i just added, but doesnt work; url generated for
non-working link:
http://www.lasvegasunions.info/prov-...y=Clark&subcat...


when view sourcing in browser, this link works:
<a href="prov-results1.aspx?
county=Clark&subcat=Maintenance&category=Autos++++ +++++++++++++++++++
+
+
+++++&uregion=lv">Maintenance</a>


view sourcing in browser, this link does not work:
<a href="prov-results1.aspx?
county=Clark&subcat=Auctions&category=Autos&uregio n=lv">Auctions</a>
....the link that works has spaces/+ signs in it, but I am stripping
spaces with Server.UrlEncode (?????)

....i tried using asp:hyperlink and NavigateUrl with this, but it was a
mess with incorrectable "Expected Statement" errors


TIA
mr. ed


Nathan Sokalski 09-25-2007 05:22 AM

Re: Datalist control problem with hyperlink
 
First of all, when creating your databinding expression, you need to be
careful with your quotes. Because you are using double-quotes (") to
surround your entire href, the expression is confused when it sees you using
double-quotes in the individual pieces as well. To fix this, use
single-quotes to surround the entire thing instead. Also, I believe you need
to use the + sign as the concatenation operator when combining individual
parts in the expression, regardless of you programming language. Have you
checked to see exactly what is generated when you do the databinding?
Sometimes looking at what is generated can help, we all make stupid little
mistakes, even on the simplest tasks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

"mister-Ed" <276q@cox.net> wrote in message
news:1190244803.508965.212580@y42g2000hsy.googlegr oups.com...
>I am displaying subcategories in my datalist, and now I have a
> bizarre thing happen when I add a new subcategory record in my sql
> database, the new subcategory link does not click into the next page.
> When clicking the link, nothing happens!:
>
> code to link w/querystrings formatted:
> <a href="prov-results1.aspx?county=<
> %#Server.UrlEncode(Request.QueryString("county")) & "&subcat=" &
> Server.UrlEncode((Eval("SubCategory").ToString())) & "&category=" &
> Server.UrlEncode((Eval("Category").ToString())) & "&uregion=" &
> Server.UrlEncode((Eval("uregion").ToString()))%>"> <%#
> Eval("SubCategory")%></a>
>
>
> url generated for working link:
> http://www.lasvegasunions.info/prov-...y=Clark&subcat...
>
>
> a subcat link that i just added, but doesnt work; url generated for
> non-working link:
> http://www.lasvegasunions.info/prov-...y=Clark&subcat...
>
>
> when view sourcing in browser, this link works:
> <a href="prov-results1.aspx?
> county=Clark&subcat=Maintenance&category=Autos++++ +++++++++++++++++++
> +
> +
> +++++&uregion=lv">Maintenance</a>
>
>
> view sourcing in browser, this link does not work:
> <a href="prov-results1.aspx?
> county=Clark&subcat=Auctions&category=Autos&uregio n=lv">Auctions</a>
> ...the link that works has spaces/+ signs in it, but I am stripping
> spaces with Server.UrlEncode (?????)
>
> ...i tried using asp:hyperlink and NavigateUrl with this, but it was a
> mess with incorrectable "Expected Statement" errors
>
>
> TIA
> mr. ed
>





All times are GMT. The time now is 11:34 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.