depart.aspx
来自「商机管理系统」· ASPX 代码 · 共 156 行
ASPX
156 行
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="depart.aspx.cs" Inherits="role_departtree" %>
<!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" >
<base target="_self"></base>
<head runat="server">
<title>无标题页</title>
<script lang="javascript" type="text/javascript" >
// JScript 文件
var lastRowSelected;
var originalColor;
function GridView_selectRow(row, Name)
{
var hdn=document.form1.hdninput;
hdn.value = Name;
if (lastRowSelected != row)
{
if (lastRowSelected != null)
{
lastRowSelected.style.backgroundColor = originalColor;
lastRowSelected.style.color = 'Black'
lastRowSelected.style.fontWeight = 'normal';
}
originalColor = row.style.backgroundColor
row.style.backgroundColor = 'BLACK'
row.style.color = 'White'
row.style.fontWeight = 'normal'
lastRowSelected = row;
}
}
function additem()
{
var hdn=document.getElementById("hdninput");
var se=document.getElementById("se1");
var option = document.createElement("option");
var str='';
if(hdn.value==null || hdn.value=="" || hdn.value==" ")
{
alert("请选择员工!");
return;
}
else
{
if(se.length>0)
{
//alert(se.length);
for(var i=0; i<se.length; i++)
{
//str+=' '+se.options[i].value;
if(se.options[i].value==hdn.value)
{
alert("请勿输入同一个名字!");
return;
}
}
}
//alert(str);
option.value=hdn.value;
option.text=hdn.value;
se.options.add(option);
}
}
function removeitem()
{
var se=document.getElementById("se1");
if(se.selectedIndex==-1)
return false;
var option=se.options[se.selectedIndex];
se.removeChild(option);
sec.selectedIndex=-1;
}
function GridView_mouseHover(row)
{
row.style.cursor = 'hand';
}
function confirm()
{
var se1=document.getElementById("se1");
var str="";
if(se1.length>0)
{
for(var i=0;i<se1.length;i++)
{
str+=se1.options[i].value+';';
}
}
var a = str;
//alert(a);
window.returnValue=a;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="hdninput" runat="server" name="hdninput" type="hidden" value=" " />
<table style="" border=1px align="center">
<tr>
<td rowspan="6" align="center" width=120px>
<asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound" AutoGenerateColumns="False" ShowHeader="False" DataSourceID="SqlDataSource1" Width="100px">
<Columns>
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
</Columns>
</asp:GridView>
</td>
<td rowspan="2" >
</td>
<td rowspan="6" align="center">
<select size="20" name="se1" runat="server" id="se1" style="width:150px;">
</select>
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center">
<input id="add" type="button" value=">>" onclick="additem()" /></td>
</tr>
<tr>
<td align="center">
<input id="remove" type="button" value="<<" onclick="removeitem()" /></td>
</tr>
<tr>
<td rowspan="2" height=50%>
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center" colspan="3" rowspan="1">
<input id="Btn_confirm" type="button" value="确认" onclick="confirm()" />
<asp:Button ID="Btn_Cancel" runat="server" Text="取消" OnClick="Btn_Cancel_Click" /></td>
</tr>
</table>
</div>
<asp:HiddenField ID="Hid_Did" runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:sjglxt %>"
SelectCommand="SELECT [name] FROM [depart]"></asp:SqlDataSource>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?