如何在ASP.NET中的菜单和子菜单中设置权限 [英] How to set rights in menu and sub menu in ASP.NET
本文介绍了如何在ASP.NET中的菜单和子菜单中设置权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有菜单和子菜单.我想根据我的SQL查询表单访问权限来设置这些菜单的访问权限.
该怎么做..?
看到我的ASPX代码
-----------------
Hi,
I have menu and sub menu''s. I want to set access permissions for these menu''s based on my SQL Query forms access.
How to do this..?
see my ASPX Code
-----------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>ASP.NET Menu + jQuery</title>
<style type="text/css">
li
{
border:1px solid black;
padding:2px 2px 2px 2px;
width:210px;
background-color:#82C0FF;
color:black;
cursor:pointer;
}
a { color:black; font: bold 11px Verdana; }
#nav table { display:inline;}
#nav tr { display:inline; }
#nav td { display:inline;}
#nav a {display:inline;}
</style>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(function () {
$("ul.level1 li").hover(function () {
$(this).stop().animate({ opacity: 0.7, width: "210px" }, "slow");
}, function () {
$(this).stop().animate({ opacity: 1, width: "170px" }, "slow");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="menu" class="nav">
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" RenderingMode="List">
<Items>
<asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home" />
<asp:MenuItem Text="Master" Value="first">
<asp:MenuItem Text="Admin" Value="Admin"></asp:MenuItem>
<asp:MenuItem Text="Prod" Value="Pro"></asp:MenuItem>
<asp:MenuItem Text="MaP" Value="Mr"></asp:MenuItem>
<asp:MenuItem Text="Cory" Value="Cy"></asp:MenuItem>
<asp:MenuItem Text="Ponal Role Mappings" Value="ap"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Transaction" Value="Second">
<asp:MenuItem Text="Dment Activities" Value="DX"></asp:MenuItem>
<asp:MenuItem Text="Input" Value="SA"></asp:MenuItem>
<asp:MenuItem Text="Power" Value="KP"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Reports" Value="Third">
<asp:MenuItem Text="Reports" Value="Reports"></asp:MenuItem>
<asp:MenuItem Text="Power" Value="AL"></asp:MenuItem>
<asp:MenuItem Text="All" Value="XY"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/arts.aspx" Text="arts" Value="charts" />
</Items>
</asp:Menu>
</div>
</form>
</body>
</html>
我不想一直显示所有菜单.
我想从表nd获得访问权限,然后应该显示菜单.
I don''t want to display all the menu''s at all the times.
I want to get the access rights from the table nd then menu should display.
Table Values
-------------
Admin
Employee
Customer
Reports
Others
Help
如果表中的管理员"为"Y",则应从主菜单显示管理员菜单.
if "Admin" as "Y" in the table, then admin menu shuould display from the master menu.
推荐答案
(函数(){
(" ).hover(函数(){
("ul.level1 li").hover(function () {
( this ).stop().animate({opacity: 0 . 7 ,宽度:" }," 慢"); },功能(){
(this).stop().animate({ opacity: 0.7, width: "210px" }, "slow"); }, function () {
这篇关于如何在ASP.NET中的菜单和子菜单中设置权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文