Re: Repeater and Eval

Efran Cobisi <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Organization QBGROUP SpA
Message-ID <[email protected]>
Gabriel,

Sticking with the declarative model, even if I am not a big fan of it,
you could set up the Visible property as you have done with other
properties, like NavigateUrl:

<asp:HyperLink runat="server" NavigateUrl='<%# Eval("Url") %>'
Visible='<%# !String.IsNullOrEmpty(Eval("Url")) %>'><%# Eval("Title")
%></asp:HyperLink>

HTH,

--
Efran Cobisi
http://www.cobisi.com

Gabriel 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®  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.