You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Grids/wucGridView.ascx

162 lines
6.7 KiB
Plaintext

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="wucGridView.ascx.cs" Inherits="DSWeb.wucGridView" %>
<!--双击弹出页面-->
<script language="javascript" type="text/javascript">
function ShowDetail(type,ID)
{
var feature = "";
var URLs = "";
var ret = "";
if(type == 1)
{
feature = "dialogWidth:800px;dialogHeight:600px;center:yes;help:no;resizable:yes;scroll:auto;status:no;";
URLs = "PersonnelInfoLook.aspx";
ret = window.showModelessDialog(URLs,null, feature);
return ret;
}
else
{
feature = "dialogWidth:400px;dialogHeight:310px;center:yes;help:no;resizable:yes;scroll:auto;status:no;";
URLs = "PersonnelReport_Setting.aspx?PersonnelId=" + ID + "&tmp=" + Math.random();
ret = window.showModelessDialog(URLs,null, feature);
return ret;
}
}
function openLink(id,handle)
{
var openUrl = handle+id;
window.open (openUrl, "_blank", "height=768, width=1024, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2);
}
</script>
<!--多选-->
<script type="text/javascript">
// 用于记录第一次选中的行号
var selectedIndex = 0;
// CheckBox 的 onClick 事件, 监听是否按下"Shift"键, 如果按下"Shift"键, 则实现多选
function checkboxClick(obj)
{
// 获取主GridView
var tableMain = obj.parentElement.parentElement.parentElement.parentElement;
// 获取当前选中的行号
var currIndex = 0;
var count = tableMain.firstChild.childNodes.length;
for(i = 0; i < count; i++)
{
if(tableMain.firstChild.childNodes[i].firstChild.firstChild.id == obj.id)
{
currIndex = i;
break;
}
}
// 判断是否按下了Shift键
if(event.shiftKey)
{
// 将两次选中的记录之间的所有的记录都设为选中状态
if(currIndex > 0 && selectedIndex > 0)
{
if(currIndex < selectedIndex)
{
for(i = currIndex; i < selectedIndex; i++)
{
tableMain.firstChild.childNodes[i].firstChild.firstChild.checked = true;
tableMain.rows(i).style.backgroundColor='#FFFFFF';
}
}
else
{
for(i = selectedIndex; i < currIndex; i++)
{
tableMain.firstChild.childNodes[i].firstChild.firstChild.checked = true;
}
}
}
}
// 判断CheckBox是否为选中, 如果为选中状态, 则记录当前的行号, 否则记录为"0"
if(obj.checked)
{
selectedIndex = currIndex;
}
else
{
selectedIndex = 0;
}
}
</script>
<script language="javascript" type="text/javascript">
var resultA=null;
var resultB=null;
function showmm(obj)
{
var gview = document.getElementById('GridView1');
for(var i=0;i<gview.rows.length;i++)
{
if(gview.rows(i).rowIndex==obj.rowIndex)
obj.style.backgroundColor='#D3E0FF';
else
gview.rows(i).style.backgroundColor='#FFFFFF';
}
resultA = obj.rowIndex;
}
document.onkeydown = function(event)
{
event = window.event || event;
if(event.shiftKey)
{
stat=resultA;
//shift按下后执行的代码块
}
}
</script>
<!--排序-->
<style type="text/css">
.headStyle a{text-decoration:none;}
</style>
<!--右键菜单-->
<style type="text/css">
#divh { position:absolute; z-index:1001; left:40%; top:30%; width:300px; margin-left:-200px; border:solid 6px #ddd; }
.box { border:solid 1px #999; font-size:14px; }
#tit { border-bottom:solid 1px #999;background-color:#cccccc; padding:6px; font-weight:bold;}
#bod { background-color:#ffffff; padding:20px; }
#bot { border-top:solid 1px #999;background-color:#cccccc; text-align:right;}
.menu { position:absolute; z-index:101; width:100px; border:solid 1px #999; padding:2px; background-color:#ffffff;}
.menu a { display:block; padding:3px 6px; font-size:12px; color:#000000; cursor:default; text-decoration:none; }
.menu a:hover { background-color:#507cd1; color:#ffffff;}
</style>
<script type="text/javascript" src="../../../js/Grid/jsGrid.js"></script>
<div id="div1">
<asp:GridView ID="GridView1" runat="server" Width="100%"
Font-Size="12px" ForeColor="Black" AllowPaging="True"
onrowdatabound="GridView1_RowDataBound" AllowSorting="True"
onsorting="GridView1_Sorting" GridLines="Horizontal"
onpageindexchanging="GridView1_PageIndexChanging" PageSize="10">
<FooterStyle BackColor="#E0E3E8" Font-Size="12px" ForeColor="Black"
Height="21px" />
<RowStyle HorizontalAlign="center" Font-Size="12px" Height="20px" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelected"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle Font-Size="12px" Height="21px" VerticalAlign="Middle" HorizontalAlign="Center" BackColor="#E0E3E8" />
<SelectedRowStyle BackColor="#5A7EBF" ForeColor="White" />
<HeaderStyle BackColor="#E0E3E8" CssClass="headStyle" BorderColor="#CDD4E3"
Font-Size="12px" Height="22px" />
</asp:GridView>
</div>
<div id="divh" style="display: none;">
<div class="box">
<div id="tit"></div>
<div id="bod"></div>
<div id="bot"></div>
</div>
</div>