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. 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.

Similar Posts

« »