I was just wondering if it is possible to bind data using DataBinder.Eval
on a html tag with runat=server
attribute. For example i want to do something like:
<a href=<%#DataBinder.Eval(Container.DataItem, "file_name") %> runat="se开发者_开发知识库rver" />
but it doesn't work. does this mean i have to use the asp.net hyperlink control?
Cheers,
Stephen
try this instead:
<a href='<%#Eval("file_name") %>' >Link text goes here...</a>
It works if the element is inside a bindable control, like a DataList or a GridView, and you don't need server control:
<a href='<%# Eval("file_name") %>' />
精彩评论