zoukankan
html css js c++ java
ASP.NET&Spring.NET&NHibernate最佳实践(六)——第3章人事子系统(3)
3.6. 人事子系统表示层(Web)
修改Depts.aspx
<
asp:Panel
ID
="Panel1"
runat
="server"
GroupingText
="部门列表"
>
<
br
/>
<
asp:GridView
ID
="GridView1"
runat
="server"
DataSourceID
="odsDepts"
DataKeyNames
="ID"
AutoGenerateColumns
="False"
Width
="100%"
AllowPaging
="true"
PageSize
="10"
>
<
Columns
>
<
asp:TemplateField
>
<
ItemTemplate
>
<
asp:Button
ID
="btnEdit"
runat
="server"
CommandName
="Edit"
Text
="编辑"
/>
<
asp:Button
ID
="btnDelete"
runat
="server"
CommandName
="Delete"
Text
="删除"
OnClientClick
="return confirm('您真的要删除吗?')"
/>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:Button
ID
="btnUpdate"
runat
="server"
CommandName
="Update"
Text
="更新"
/>
<
asp:Button
ID
="btnCancel"
runat
="server"
CommandName
="Cancel"
Text
="取消"
/>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
HeaderText
="部门代码"
DataField
="Code"
/>
<
asp:BoundField
HeaderText
="部门名称"
DataField
="Name"
/>
</
Columns
>
</
asp:GridView
>
</
asp:Panel
>
<
hr
/>
<
asp:Panel
ID
="Panel2"
runat
="server"
GroupingText
="新增部门"
>
<
br
/>
<
asp:FormView
ID
="FormView1"
runat
="server"
DataSourceID
="odsDepts"
DefaultMode
="Insert"
>
<
InsertItemTemplate
>
<
table
width
="100%"
border
="0"
cellpadding
="2"
cellspacing
="2"
>
<
tr
>
<
td
>
部门代码
</
td
>
<
td
>
<
asp:TextBox
ID
="txtCode"
runat
="server"
Width
="200"
Text
='<%#
Bind("Code") %
>
' />
</
td
>
</
tr
>
<
tr
>
<
td
>
部门名称
</
td
>
<
td
>
<
asp:TextBox
ID
="txtGroupName"
runat
="server"
Width
="200"
Text
='<%#
Bind("Name") %
>
' />
</
td
>
</
tr
>
</
table
>
<
p
>
<
asp:Button
ID
="btnInsert"
runat
="server"
CommandName
="Insert"
Text
="新增"
/>
</
p
>
</
InsertItemTemplate
>
</
asp:FormView
>
</
asp:Panel
>
<
asp:ObjectDataSource
ID
="odsDepts"
runat
="server"
TypeName
="Guushuuse.SalaryPrj.HR.Helper.HRHelper"
SelectMethod
="GetAllDepts"
InsertMethod
="CreateDept"
UpdateMethod
="UpdateDept"
DeleteMethod
="DeleteDept"
></
asp:ObjectDataSource
>
修改Employees.aspx
<%
@ Page Language
=
"
C#
"
MasterPageFile
=
"
~/MasterPage.master
"
AutoEventWireup
=
"
true
"
CodeFile
=
"
Employees.aspx.cs
"
Inherits
=
"
Employees
"
%>
<
asp:Content
ID
="LeftColumnContent"
ContentPlaceHolderID
="LeftColumnZone"
runat
="server"
>
</
asp:Content
>
<
asp:Content
ID
="MiddleColumnContent"
ContentPlaceHolderID
="MiddleColumnZone"
runat
="server"
>
<
asp:Panel
ID
="Panel1"
runat
="server"
GroupingText
="员工列表"
>
<
br
/>
<
asp:GridView
ID
="GridView1"
runat
="server"
DataSourceID
="odsEmployees"
DataKeyNames
="ID"
AutoGenerateColumns
="False"
Width
="100%"
AllowPaging
="true"
PageSize
="10"
>
<
Columns
>
<
asp:TemplateField
>
<
ItemTemplate
>
<
asp:Button
ID
="btnEdit"
runat
="server"
CommandName
="Edit"
Text
="编辑"
/>
<
asp:Button
ID
="btnDelete"
runat
="server"
CommandName
="Delete"
Text
="删除"
OnClientClick
="return confirm('您真的要删除吗?')"
/>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:Button
ID
="btnUpdate"
runat
="server"
CommandName
="Update"
Text
="更新"
/>
<
asp:Button
ID
="btnCancel"
runat
="server"
CommandName
="Cancel"
Text
="取消"
/>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
HeaderText
="工号"
DataField
="Code"
/>
<
asp:BoundField
HeaderText
="姓名"
DataField
="Name"
/>
<
asp:TemplateField
HeaderText
="部门"
>
<
ItemTemplate
>
<
asp:Label
ID
="lblDeptName"
runat
="server"
Text
='<%#
Eval("DeptName") %
>
' />
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:DropDownList
ID
="lstDepts"
runat
="server"
DataTextField
="Name"
DataValueField
="ID"
DataSourceID
="odsDepts"
SelectedValue
='<%#
Bind("DeptID") %
>
'>
</
asp:DropDownList
>
</
EditItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
</
asp:Panel
>
<
hr
/>
<
asp:Panel
ID
="Panel2"
runat
="server"
GroupingText
="新增员工"
>
<
br
/>
<
asp:FormView
ID
="FormView1"
runat
="server"
DataSourceID
="odsEmployees"
DefaultMode
="Insert"
>
<
InsertItemTemplate
>
<
table
width
="100%"
border
="0"
cellpadding
="2"
cellspacing
="2"
>
<
tr
>
<
td
>
工号
</
td
>
<
td
>
<
asp:TextBox
ID
="txtCode"
runat
="server"
Width
="200"
Text
='<%#
Bind("Code") %
>
' />
</
td
>
</
tr
>
<
tr
>
<
td
>
姓名
</
td
>
<
td
>
<
asp:TextBox
ID
="txtGroupName"
runat
="server"
Width
="200"
Text
='<%#
Bind("Name") %
>
' />
</
td
>
</
tr
>
<
tr
>
<
td
>
部门
</
td
>
<
td
>
<
asp:DropDownList
ID
="lstDepts"
runat
="server"
DataTextField
="Name"
DataValueField
="ID"
DataSourceID
="odsDepts"
SelectedValue
='<%#
Bind("DeptID") %
>
'>
</
asp:DropDownList
>
</
td
>
</
tr
>
</
table
>
<
p
>
<
asp:Button
ID
="btnInsert"
runat
="server"
CommandName
="Insert"
Text
="新增"
/>
</
p
>
</
InsertItemTemplate
>
</
asp:FormView
>
</
asp:Panel
>
<
asp:ObjectDataSource
ID
="odsEmployees"
runat
="server"
TypeName
="Guushuuse.SalaryPrj.HR.Helper.HRHelper"
SelectMethod
="GetAllEmployees"
InsertMethod
="CreateEmployee"
UpdateMethod
="UpdateEmployee"
DeleteMethod
="DeleteEmployee"
></
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
="odsDepts"
runat
="server"
TypeName
="Guushuuse.SalaryPrj.HR.Helper.HRHelper"
SelectMethod
="GetAllDepts"
></
asp:ObjectDataSource
>
</
asp:Content
>
查看全文
相关阅读:
JSTL 配置
HTML5 移动端web
PHP 和 AJAX MySQL
js php 互调
google F12
Codechef TRIPS Children Trips (分块、倍增)
BZOJ 1859 Luogu P2589 [ZJOI2006]碗的叠放 (计算几何)
AtCoder AGC002E Candy Piles (博弈论)
BZOJ 2716 [Violet 3]天使玩偶 (CDQ分治、树状数组)
AtCoder AGC001F Wide Swap (线段树、拓扑排序)
原文地址:https://www.cnblogs.com/pricks/p/1744428.html
最新文章
VS2010-自定义控件
线程
控件重绘
socket网络编程
CSS——标准盒子模型
CSS样式属性——字体+文本
java String 不可变
commons
Tomcat localhost 8080打不开
SpringMVC json
热门文章
SpringMVC handleMapping 处理器映射器 属性清单
dom4j 间隔插入节点 处理复杂的xml文档
Oracle loop循环无法插入数据
springmvc 访问时找不到配置文件
Oracle 11g必须开启的服务及服务详细介绍
JavaScript(jquery)实现二级菜单联动
important的妙用解决firefox和ie的css兼容问题
EL 表达式
URI URL URN 关系
163 AJAX
Copyright © 2011-2022 走看看