Came across a little bug today that I thought it was worth mentioning in case it helps anyone else out. Say you have a repeater control and somewhere in there your using eval to populate a control in there. This kind of thing for example:
<asp:label id="label1" runat="server" text='Some Link<%#Eval "Link" %>' />
Works perfect as you would expect it to, however if you tried to do the following:
<asp:hyperlink id="hyperlink1" runat="server" navigateurl='Some Link<%#Eval "Link" %>' >Some Text</asp:hyperlink>
You will find that it doesn’t work, there seems to be a bug that stops it evaluating the eval code. However it is pretty easy to fix, all you need to do is reformat the control as such:
<asp:hyperlink id="hyperlink1" runat="server" navigateurl='<%#"Some Link" & Eval "Link" %>' >Some Text</asp:hyperlink>
Now it works, weird huh.


Subscribe to blog via RSS Feed
Follow Me On Twitter
Michael Appleton said,
I had the exact same issue and thanks to you its sorted. I’m new to ASP and found this very helpful.
Thanks for the short but helpful post.
Michael Appleton
Michael Appleton´s last blog ..What can we expect from the next chapter? Traffic Ultimatum
Steve Kinsey said,
My pleasure, always glad to see when these posts can help someone out.
Add A Comment