Hi,
i want to show different menu for different users but dont show menu
for example a users show only home page in menu
b users show about page and home page in menu
c user show only about page in menu
I have 3 tables in databases
1. Kullanıcılar[in english users] (username(PK) ve userpassword fields)
2. Menuler (MenuId(PK),SayfaAdi ve SayfaLink[In english PageLink] fields)
3. KullaniciMenu(username ve menuid fields)
---------------
public class MenuBilgi
{
private string sayfaAdi;
private string sayfaLink;
public string SayfaLink
{
get { return sayfaLink; }
set { sayfaLink = value; }
}
public string SayfaAdi
{
get { return sayfaAdi; }
set { sayfaAdi = value; }
}
public MenuBilgi(string sayfaAdi, string sayfaLink)
{
this.sayfaAdi = sayfaAdi;
this.sayfaLink = sayfaLink;
}
}
--------------------------------------------
aLTER proc [dbo].[MenuGetir]
(
@Username nvarchar(15)
)
as
select SayfaAdi,SayfaLink from Menuler inner join KullaniciMenu on Menuler.MenuId=Kullanici.MenuId where KullaniciMenu.Username=@Username
------------------------------------
public partial class SiteMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
SqlParameter[] paramdizi = new SqlParameter[1]
{
new SqlParameter("@UserName",SqlDbType.NVarChar)
};
paramdizi[0].Value = Session["Username"];
Baglanti baglanti = new Baglanti();
SqlDataReader dr = baglanti.ExecuteReader("MenuGetir", CommandType.StoredProcedure, paramdizi);
List<MenuBilgi> liste = new List<MenuBilgi>();
while (dr.Read())
{
MenuBilgi bilgi = new MenuBilgi(dr.GetString(0), dr.GetString(1));
liste.Add(bilgi);
}
NavigationMenu.DataSource = liste; NavigationMenu.DataBind();
}
}
-------------------------------------
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
</Items>
</asp:Menu>
But navigationmenu.datasource=liste; >>> THİS ERROR MESAJ: HierrarhicalDataBoundControl only accept datasources that implement HierarchicalDataSource or HierarchicalEnumerable.
help pls