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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with URL binding using eval in a datalist.

Status
Not open for further replies.

collegian

Programmer
Jul 1, 2010
64
US
Hello All,

I am using Eval inside a datalist to populate a hyperlink within the datalist with a navigateURL value and I am using it as follows:

<asp:HyperLink ID="HyperLink_FullStory" runat="server" Text="Full Story" NavigateUrl='<%#Eval("LinkAddress")%>'></asp:HyperLink>

The issue I am facing is that the current page URL is getting appended to the 'LinkAddress'(the URL being fetched from the database) and thus,the final URL formed is not a valid one.Can someone suggest how do I remove the current page URL?

Thanks.
 
I'm not sure why that is happening. I avoid putting code in the HTML markup. I would use the ItemDataBound event of the datalist, then use the findcontrol() method to find your hyperlink, and then set the NavigateURL property.
 
Thanks for the reply.I was just wondering if there was any way I could do it without using FindControl, I mean do it on the front end itself instead of the code behind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top