Wednesday, 27 August 2014

Binding / concatenating a string literal with eval

Recently i have a requirement where i have to bind an anchor tag with two parameters in repeater. I have search for few time and then one of my friend suggest  me the following solution

<a href='<%#string.Concat(siteURL,Convert.ToString(DataBinder.Eval(Container.DataItem,"TargetURL"))) %>'
 <%# Container.ItemIndex==0?"class=\"fc\"":string.Empty %>><%#DataBinder.Eval(Container.DataItem,"Title") %>
</a>



No comments:

Post a Comment