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
>
查看全文
相关阅读:
Java Spring AOP用法
Spring IOC的简单实现
随机数
Java 正则表达式
日期格式转换
maven settings.xml详解
JSP与Servlet的关系
EL表达式学习
FreeMarker学习2
FreeMarker学习
原文地址:https://www.cnblogs.com/pricks/p/1744428.html
最新文章
元类
异常处理
Centos7下安装syslog-ng
消息队列的对比调研
centos7下git服务器端搭建
VMware虚拟机配置端口转发(端口映射),实现远程访问
Centos7安装Redis
Linux命令:linux软链接的创建、删除和更新---ln
Linux命令:tar命令批量解压方法总结
Linux命令:xargs命令详解,xargs与管道的区别
热门文章
用lua扩展你的Nginx(整理)-----openresty
Ngx_Lua使用分享
rabbitMQ第三篇:采用不同的交换机规则
rabbitMQ第二篇:java简单的实现RabbitMQ
rabbitMQ第一篇:rabbitMQ的安装和配置
eclipses配置tomcat
SSM框架——使用MyBatis Generator自动创建代码
安装Mybatis插件
TP-Link 路由器 如何在现有的环境中改善无线信号传输质量
Java Spring IOC用法
Copyright © 2011-2022 走看看