Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Problems with dynamic links in Datalist

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mister-Ed - 30 Aug 2007 18:56 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.