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:
Here is the code surrounding my dynamic 'subcategory':
<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>
In the page source code , the subcategory that works has + signs
after the Category value. I have used
Server.UrlEncode((Eval("Category").ToString().trim())) to eliminate
these erroneous + signs, but that disables ALL the links from
working :
<a href="prov-results1.aspx?
county=Clark&subcat=Asbestos&category=Attorneys++++++++++++++++++++++++
++&uregion=lv">Asbestos</a>
The subcategory that I have just added to the database doesnt work
when trying to click:
<a href="prov-results1.aspx?
county=Clark&subcat=CriminalLaw&category=Attorneys&uregion=">CriminalLaw</
a>
...i've used NavigateURL in the datalist in the past, but with
problems
??
Ed
Nathan Sokalski - 31 Aug 2007 17:26 GMT
Something that I might recommend (it may not explain your problem) would be
to, first of all, use the ASP.NET HyperLink control instead. I might also
suggest that because you have so many inline functions that you use the
ItemDataBound event, the String.Format method, and assign the results to the
NavigateUrl property. Also, I believe that when inside the <%# %> tags, you
need to use + instead of &. Also, did you try doing a View Source of the
output for your current code? This can sometimes help you figure out exactly
what part is not working. Good Luck!

Signature
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.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
[quoted text clipped - 31 lines]
> ??
> Ed