Here's my .aspx code.
I need to make it so that the "Visit web site" link doesn't show up, if there is no url present.. But
<% if (Eval("Website" ) == "") does not work..
I get the following error:
"Databindin g methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
I'm more of a php guy, so this is a little over my head.. IF anyone can provide any info, it'll be greatly appreciated.
Code:
<asp:DataList ID="DataList1" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal">
<ItemTemplate>
<tr class="<%# Eval("TRClass") %>">
<td>
<div class="member_dir">
<img class="mb_logo" src="<%# Eval("Logo") %>" />
<div class="mb_info">
<div class="_company"> <span id="ctl00_cphContent_RadGrid1_ctl01_ctl04_UserNameLabel"> <%# Eval("Company") %> </span> </div>
<div class="_address"> <%# Eval("Address") %> <br /> <%# Eval("City") %>, <%# Eval("State") %> <%# Eval("Zip") %></div>
<div class="_phone"> <%# Eval("Phone") %> </div>
<% if (Eval("Website") == "")
{
// Do Nothing
} else { %>
<div class="_link"> <a href="<%# Eval("Website") %>" target="_blank"> Visit Web Site </a> </div> <% } %>
</div>
</div>
</td>
</tr>
</ItemTemplate>
</asp:DataList>
I need to make it so that the "Visit web site" link doesn't show up, if there is no url present.. But
<% if (Eval("Website" ) == "") does not work..
I get the following error:
"Databindin g methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
I'm more of a php guy, so this is a little over my head.. IF anyone can provide any info, it'll be greatly appreciated.
Comment