I have a simple gridview ItemTemplate that looks like this:
<asp:TemplateField HeaderText="User"> <ItemTemplate> <a href="mailto:<%# Eval("Email") %>"><%# Eval("Name") %></a> </ItemTemplate> </asp:TemplateField>
However, not all users of this list have emails stored in the system, which means that Eval ("Email") sometimes returns empty. When this happens, I do not want to have a link to the field, since mailto will not work without an email address.
How can i do this? I was hoping I could use the IF statement in the view code, for example, how classic ASP worked. If not, I suggest that I could create a property on my data source that includes all the href html ...
Slider345
source share