GridView鼠标右键
来源:互联网 发布:民营企业并购数据统计 编辑:程序博客网 时间:2024/05/21 10:34
以上是效果截图
aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QYCarFYApplyManage.aspx.cs"
Inherits="QYCarFYApplyManage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>出租车废业审批管理</title>
<script type="text/javascript">
function a1(id) {
if (event.button == "2") {
$get("HiddenField1").value = id;
}
// switch (event.button) {
// case 1: alert('left'); break;
// case 2: alert('right'); break;
// case 3: alert('left && right'); break;
// case 4: alert('middle'); break;
// case 5: alert('left && middle'); break;
// case 6: alert('right && middle'); break;
// case 7: alert('left && middle && right'); break;
// }
}
function popclose() {
$find("ModalPopupExtender1").hide();
}
function stop() {
return false;
}
</script>
<style type="text/css">
.GridViewHead
{
background-color: #e0e0e0;
font-weight: bold;
font-size: 15px;
}
.GridViewRow
{
font-size: 14px;
height: 28px;
}
</style>
<style type="text/css">
.modalPopup
{
background-color: #EDF6FF;
border-width: 3px;
border-style: solid;
border-color: Gray;
padding: 3px;
}
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=70);
opacity: 0.7;
}
.skin0
{
position: absolute;
text-align: left;
width: 200px;
border: 2px solid black;
background-color: menu;
font-family: Verdana;
line-height: 20px;
cursor: default;
visibility: hidden;
}
.skin1
{
cursor: default;
font: menutext;
position: absolute;
text-align: left;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
width: 120px;
background-color: Silver;
border: 1 solid buttonface;
visibility: hidden;
border: 2 outset buttonhighlight;
}
.menuitems
{
padding-left: 15px;
padding-right: 10px;
}
</style>
<script type="text/javascript">
<!-- Begin
var menuskin = "skin1"; // skin0, or skin1
var display_url = 0; // Show URLs in status bar?
function showmenuie5() {
var rightedge = document.body.clientWidth - event.clientX;
var bottomedge = document.body.clientHeight - event.clientY;
if (rightedge < ie5menu.offsetWidth)
ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
else
ie5menu.style.left = document.body.scrollLeft + event.clientX;
if (bottomedge < ie5menu.offsetHeight)
ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
else
ie5menu.style.top = document.body.scrollTop + event.clientY;
ie5menu.style.visibility = "visible";
return false;
}
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
}
function highlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "highlight";
event.srcElement.style.color = "white";
if (display_url)
window.status = event.srcElement.url;
}
}
function lowlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "";
event.srcElement.style.color = "black";
window.status = "";
}
}
function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
else
window.location = event.srcElement.url;
}
}
// End -->
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="text-align: center">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="700px"
OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="序号"></asp:TemplateField>
<asp:TemplateField HeaderText="公司名称">
<ItemTemplate>
<%#Eval("公司名称")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="车牌号">
<ItemTemplate>
<%#Eval("车牌号")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="申请日期">
<ItemTemplate>
<%#Eval("申请日期")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="申请人">
<ItemTemplate>
<%#Eval("申请人")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:LinkButton ID="linkbtn_look" runat="server" CommandName="look" CommandArgument='<%#Eval("编号") %>'>查看</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="GridViewHead" Height="30px" HorizontalAlign="Center" />
<RowStyle CssClass="GridViewRow" />
</asp:GridView>
</div>
<asp:Button ID="Button6" runat="server" Text="Button" Width="0" Height="0" Style="display: none;" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="PanelM"
DropShadow="true" Drag="true" Y="150" DynamicServicePath="" BackgroundCssClass="modalBackground"
Enabled="True" TargetControlID="Button6">
</cc1:ModalPopupExtender>
<asp:Panel ID="PanelM" runat="server" Style="border: solid 6px #ddd; width:300px;">
<asp:Panel ID="PanelBody" runat="server" CssClass="modalPopup"
Style="border: solid 1px #999; font-size: 12px;" ScrollBars="Auto" BorderStyle="Solid"
BorderWidth="1px">
<div id="tit" style="border-bottom:solid 1px #999;background-color:#cccccc; padding:6px; font-weight:bold;">
查看用户的详细信息
</div>
<div id="bod" style="background-color:#ffffff; padding:20px;">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
<div id="bot" style="border-top:solid 1px #999;background-color:#cccccc; text-align:right;">
<input type='button' value='关闭' onclick='popclose()' />
</div>
</asp:Panel>
</asp:Panel>
<div id="ie5menu" class="skin0">
<asp:LinkButton ID="LinkButton1" runat="server">添加</asp:LinkButton><br />
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="edits" OnCommand="LinkButton2_Command">修改</asp:LinkButton><br />
<asp:LinkButton ID="LinkButton3" runat="server" OnClientClick="return confirm('确定要删除吗')">删除</asp:LinkButton>
</div>
<asp:HiddenField ID="HiddenField1" runat="server" />
<script type="text/javascript">
if (document.all && window.print) {
ie5menu.className = menuskin;
document.oncontextmenu = stop;
document.body.onclick = hidemenuie5;
}
</script>
</form>
</body>
</html>
cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RentBLL;
public partial class QYCarFYApplyManage : System.Web.UI.Page
{
QYCarBFApplyBLL bll = new QYCarBFApplyBLL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitGridview();
}
}
private void InitGridview()
{
GridView1.DataSource = bll.GetList("").Tables[0];
GridView1.DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
string id = e.CommandArgument.ToString();
if (e.CommandName == "look")
{
Response.Redirect("QYCarFYApplyInfo.aspx?id="+id+"");
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = (e.Row.RowIndex + 1).ToString();
e.Row.Attributes.Add("onmousedown", "a1("+e.Row.Cells[0].Text+")");
e.Row.Attributes.Add("oncontextmenu", "showmenuie5()");
}
}
protected void LinkButton2_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "edits")
{
string id = HiddenField1.Value;
Label1.Text = id;
ModalPopupExtender1.Show();
}
}
}
- GridView鼠标右键
- 鼠标右键
- 鼠标右键
- 鼠标右键
- 鼠标右键
- 鼠标右键
- DX控件中鼠标双击(或鼠标右键同理)点击GridControl(GridView)的实现
- web鼠标右键自定义
- 鼠标右键的代码
- 禁止鼠标右键
- 使鼠标右键失效
- 如何屏蔽鼠标右键
- 屏蔽鼠标右键等
- 屏蔽鼠标左、右键
- 自定义鼠标右键
- FLEX屏蔽鼠标右键
- flex 屏蔽鼠标右键
- 禁止鼠标右键
- oracle表空间操作简单介绍
- Wince音频驱动(1)
- i am a tiny bird-4
- linux+weblogic部署应用个人小结
- db_recovery_file_dest_size 100% used
- GridView鼠标右键
- VC视频教程笔记一
- 【C/C++语言入门篇】-- 调试基础
- Hibernate缓存机制以及一级缓存和二级缓存的作用
- Wince音频驱动的好Blog
- 网站注入与防范ASP.NET
- 禁止root远程直接登录
- DocBook XSL完全手册(XSL简短介绍)
- Android 支持的文件类型