Como buscar un dato de ((SiteMapNode) Container.DataItem).ChildNodes desde el .cs

FerSal68 21 Reputation points

genere un Web.Sitemap y este tiene "Roles"

en mi Pagina.ASPX coloque un Repeater

<asp:Repeater runat="server"
DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>'>
<ul class="detalle" >
<asp:HyperLink runat="server" Visible= '<%#Visible()%>'
NavigateUrl='<%# Eval("Url") %>'>
<%# Eval("Title") %></asp:HyperLink>

en el HyperLink solo quiero que quede visible aquellos que el usuario pueda ver.
por eso : Visible= '<%#Visible()%>'

cuando voy a escribir Pagina.CS

namespace Pagina

public partial class Pagina : System.Web.UI.MasterPage  
        public new bool Visible()  
        if (Eval("Roles") == Session["Perm"])  
            return false;  
            return true ;  


no me trae la información (Eval("Roles") , ¿como es para traer la información de esa línea?, del Web.sitemap

A set of technologies in the .NET Framework for building web applications and XML web services.
3,240 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yijing Sun-MSFT 7,061 Reputation points

    Hi @FerSal68 ,
    As far as I think,you could create multiple sitemaps for different users.You could use SiteMapProvider to bind the repeater and according to user's role, bind their own separate sitemap files.
    By the way,please use english.
    More details,you could refer to below articles:
    Best regards,
    Yijing Sun

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful