Hi,
I am using menu control and i want to hide the menu's based on my sql condition.
Initially i am loading all the menu's in the design mode.
while page load and based on my sql condition i am removing the menu's from the list.
I want, when i remove one menu in master then the entire master and master child menu should be disappear.
When i remove one meni in transaction then entire transaction and child transaction menu should be disappear.
how to do this..
see my code
------------
ASPX Page
----------
<div id="menu" class="nav">
<asp:Menu ID="NavigationMenu" runat="server" Orientation="Horizontal" RenderingMode="List">
<Items>
<asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home" />
<asp:MenuItem Text="Master" Value="Master">
<asp:MenuItem Text="Master_Child1" Value="Master_Child1"></asp:MenuItem>
<asp:MenuItem Text="Master_Child2" Value="Master_Child2"></asp:MenuItem>
<asp:MenuItem Text="Master_Child3" Value="Master_Child3"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Transaction" Value="Tran">
<asp:MenuItem Text="Tran_Child1" Value="Tran_Child1"></asp:MenuItem>
<asp:MenuItem Text="Tran_Child2" Value="Tran_Child2"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Reports" Value="Report">
<asp:MenuItem Text="Reports" Value="Reports"></asp:MenuItem>
<asp:MenuItem Text="Report_Child1" Value="Report_Child1"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Others.aspx" Text="Others" Value="Others" />
</Items>
</asp:Menu>
</div>
ASPX.VB Code
-------------
--------------
NavigationMenu.Items.Clear()
Conn.Open()
StrQry = ""
StrQry = " Select isnull(Home,'') as Admin,isnull(Master_Child1,'') as Master_Child1,isnull(Master_Child2,'') as Master_Child2,"
StrQry &= " isnull(Tran_Child1,'') as Tran_Child1,isnull(Tran_Child2,'') as Tran_Child2,"
StrQry &= " isnull(Report_Child1,'') as Report_Child1,isnull(Report_Child2,'') as Report_Child2,"
StrQry &= " isnull(Others,'') as Others"
Cmd.Connection = Conn
Cmd.CommandText = StrQry
Rdr = Cmd.ExecuteReader
If Rdr.HasRows Then
While Rdr.Read
If Rdr("Home") = "N" Then
Dim mnuItems As New MenuItem()
NavigationMenu.Items.Remove(mnuItems)
End If
If Rdr("Master_Child1") = "N" Then
Dim mnuItems As New MenuItem()
NavigationMenu.Items.Remove(mnuItems)
End If
If Rdr("Master_Child2") = "N" Then
Dim mnuItems As New MenuItem()
NavigationMenu.Items.Remove(mnuItems)
End If
---------------
---------------
---------------
---------------
End While
End if
How to disappear the parent and child menu while all the child menu do not have rights...?