我将鼠标悬停在菜单上,一个子菜单展开,然后这个坏孩子从屏幕上出现。在我的网站上有什么可以阻止的吗?
IE6
ASPX
<%@page title=“”language=“c”masterpagefile=“~/templates/mypage.master”autoeventwireup=“true”
codefile=“tasks.aspx.cs”inherits=“ui mypage_tasks”%>
<asp:content id=“content1”contentPlaceholderID=“contentPlaceholder1”runat=“server”>
表;
<tr valign=“top”>
TD & GT;
<asp:menu id=“menu1”runat=“server”onmenuitemclick=“menu1_menuitemclick”/>
&T/GT;
TD & GT;
<cc:CustomUserControl id=“cuc1”runat=“server”/>
&T/GT;
& LT/TR & GT;
&表;
< /代码>
ASPX.CS
使用系统;
使用system.collections.generic;
使用system.linq;
使用system.web;
使用system.web.ui;
使用system.web.ui.webcontrols;
使用VAC数据;
公共部分类用户界面病人任务:基本页
{
mydb db=新建mydb();
private menuitem userrole1 menuitem get返回getmenu(common.role.userrole1);
private menuitem userrole2 menuitem get return getmenu(common.role.userrole2);
private menuitem getmenu(字符串rolename)
{
int roleid=(来自db.roles中的r,其中r.rolename==rolename选择r.roleid).first();
menuitem main=new menuitem(rolename+“menu”);
foreach(customObject co-in(来自db.customObjects中的c,其中c.roleid==roleid orderby c.sortorder select c))。
main.childitems.add(new menuitem(co.description,co.customObjectid.toString());
返回主体;
}
受保护的空页加载(对象发送程序,事件参数e)
{
如果(!)page.ispostback)页
{
menu1.items.clear();
if(user.isinRole(common.role.userRole1))。
menu1.items.add(用户角色1菜单项);
if(user.isinRole(common.role.userRole2))。
menu1.items.add(用户角色2菜单项);
}
}
受保护的void menu1_menuitemclick(对象发送方,menueventargs e)
{
int ID;
if(int.triparse(e.item.value,out id))。
{
cuc1.customObjectid=id;
}
}
}
</asp:content>
< /代码> <
我将鼠标悬停在菜单上,一个子菜单展开,然后这个坏孩子从屏幕上出现。在我的网站上有什么可以阻止的吗?
IE6
阿斯克斯
<%@ Page Title="" Language="C#" MasterPageFile="~/Templates/MyPage.master" AutoEventWireup="true"
CodeFile="Tasks.aspx.cs" Inherits="UI_MyPage_Tasks" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<table>
<tr valign="top">
<td>
<asp:Menu ID="menu1" runat="server" OnMenuItemClick="menu1_MenuItemClick" />
</td>
<td>
<cc:CustomUserControl ID="cuc1" runat="server" />
</td>
</tr>
</table>
在后台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VAC.Data;
public partial class UI_Patient_Tasks : BasePage
{
MyDB db = new MyDB();
private MenuItem UserRole1MenuItem { get { return GetMenu(Common.Role.UserRole1); } }
private MenuItem UserRole2MenuItem { get { return GetMenu(Common.Role.UserRole2); } }
private MenuItem GetMenu(string roleName)
{
int roleID = (from r in db.Roles where r.RoleName == roleName select r.RoleID).First();
MenuItem main = new MenuItem(roleName + " Menu");
foreach (CustomObject co in (from c in db.CustomObjects where c.RoleID == roleID orderby c.SortOrder select c))
main.ChildItems.Add(new MenuItem(co.Description, co.CustomObjectID.ToString()));
return main;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
menu1.Items.Clear();
if (User.IsInRole(Common.Role.UserRole1))
menu1.Items.Add(UserRole1MenuItem);
if (User.IsInRole(Common.Role.UserRole2))
menu1.Items.Add(UserRole2MenuItem);
}
}
protected void menu1_MenuItemClick(object sender, MenuEventArgs e)
{
int id;
if (int.TryParse(e.Item.Value, out id))
{
cuc1.CustomObjectID = id;
}
}
}
</asp:Content>