Re: Repeater and Eval
Ryan Heath <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Message-ID | <[email protected]> |
<% if ( !string.IsNullOrEmpty( (string)Eval("Title"))) { %>
<asp:HyperLink runat="server" NavigateUrl='<%# Eval("Url") %>'><%#
Eval("Title") %></asp:HyperLink>
<% } %>
HTH
// Ryan
On 4/26/07, Gabriel <[email protected]> wrote:
> Hello,
>
>
> I have the code below. I'd like to add a "if" to display only the hyperlink
> (the first) only when Url is not empty.
>
> How can I do that ?
>
> Regards,
>
>
>
>
>
>
> <asp:Repeater runat="server" ID="menu"
> DataSourceID="SiteMapDataSource1" EnableViewState="False">
> <ItemTemplate>
> <li>
>
> <asp:HyperLink runat="server"
> NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
>
> <asp:Repeater runat="server" DataSource='<%#
> ((SiteMapNode) Container.DataItem).ChildNodes %>'>
> <HeaderTemplate>
> <ul>
> </HeaderTemplate>
>
> <ItemTemplate>
> <li>
> <asp:HyperLink runat="server"
> NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
> </li>
> </ItemTemplate>
>
> <FooterTemplate>
> </ul>
> </FooterTemplate>
> </asp:Repeater>
> </li>
> </ItemTemplate>
> </asp:Repeater>
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com