Repeater嵌套,增删改查综合运用
2009-05-07 16:02
225 查看
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="rptClass" runat="server" OnItemCommand="rptClass_ItemCommand" OnItemDataBound="rptClass_ItemDataBound">
<HeaderTemplate>
<table>
<tr style="background-color:yellow">
<td>
添加类别:
<asp:TextBox ID="txtClassName" runat="server">
</asp:TextBox>
<asp:Button ID="btnAddClass" runat="server" CommandName="AddClass" Text="添加" />
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#CCCCCC">
<td>
<asp:Button ID="btnDelClass" CommandArgument='<%# Eval("id") %>' CommandName="DelClass" runat="server" Text="删除类别" />
<asp:TextBox ID="txtClassName" runat="server" Text='<%# Eval("className") %>'>
</asp:TextBox>
<asp:Button ID="btnUpdateClass" CommandArgument='<%# Eval("id") %>' CommandName="UpdateClass" runat="server" Text="修改类别" />
</td>
</tr>
<tr>
<td>
添加模块:
<asp:TextBox ID="txtModuleName" runat="server">
</asp:TextBox>
<asp:Button ID="btnAddModule" runat="server" CommandName="AddModule" CommandArgument='<%# Eval("id") %>' Text="添加" />
</td>
</tr>
<tr>
<td>
<asp:Repeater ID="rptModule" runat="server"
OnItemCommand='rptModule_ItemCommand'>
<ItemTemplate>
<tr>
<td>
-----------------
<asp:Button ID="btnDeleteModule" CommandArgument='<%# Eval("id") %>' CommandName="DelModule" runat="server" Text="删除模块" />
<asp:TextBox ID="txtModuleName" Text='<%# Eval("moduleName") %>' runat="server"></asp:TextBox>
<asp:Button ID="btnUpdateModule" CommandArgument='<%# Eval("id") %>' CommandName="UpdateModule" runat="server" Text="修改模块" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="rptClass" runat="server" OnItemCommand="rptClass_ItemCommand" OnItemDataBound="rptClass_ItemDataBound">
<HeaderTemplate>
<table>
<tr style="background-color:yellow">
<td>
添加类别:
<asp:TextBox ID="txtClassName" runat="server">
</asp:TextBox>
<asp:Button ID="btnAddClass" runat="server" CommandName="AddClass" Text="添加" />
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#CCCCCC">
<td>
<asp:Button ID="btnDelClass" CommandArgument='<%# Eval("id") %>' CommandName="DelClass" runat="server" Text="删除类别" />
<asp:TextBox ID="txtClassName" runat="server" Text='<%# Eval("className") %>'>
</asp:TextBox>
<asp:Button ID="btnUpdateClass" CommandArgument='<%# Eval("id") %>' CommandName="UpdateClass" runat="server" Text="修改类别" />
</td>
</tr>
<tr>
<td>
添加模块:
<asp:TextBox ID="txtModuleName" runat="server">
</asp:TextBox>
<asp:Button ID="btnAddModule" runat="server" CommandName="AddModule" CommandArgument='<%# Eval("id") %>' Text="添加" />
</td>
</tr>
<tr>
<td>
<asp:Repeater ID="rptModule" runat="server"
OnItemCommand='rptModule_ItemCommand'>
<ItemTemplate>
<tr>
<td>
-----------------
<asp:Button ID="btnDeleteModule" CommandArgument='<%# Eval("id") %>' CommandName="DelModule" runat="server" Text="删除模块" />
<asp:TextBox ID="txtModuleName" Text='<%# Eval("moduleName") %>' runat="server"></asp:TextBox>
<asp:Button ID="btnUpdateModule" CommandArgument='<%# Eval("id") %>' CommandName="UpdateModule" runat="server" Text="修改模块" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
相关文章推荐
- Repeater嵌套,增删改查综合运用
- Repeater嵌套,增删改查综合运用
- Repeater嵌套,增删改查综合运用
- C#-WebForm-Repeater的灵活运用、ItemCommand的用法-增删改查、如何不适用Repeater来展示数据?
- JAVA-练习MyShopping实现商品换购 综合运用嵌套if选择结构 switch选择结构 多重if选择 结构实现商品换购功能
- 因式分解技巧——综合运用
- 控件Repeater的嵌套使用
- net 2.0中的Repeater嵌套 的两种方法
- java- 综合实例-增删查改查,删除多项,分页,令牌机制
- HTML5快速入门(三)—— 标签综合运用
- 对Java多态性综合运用的探讨
- Excel LOOKUP的运用,以及突破IF嵌套的七层限制
- 使用嵌套的Repeater控件显示分级数据
- PHP学习 smarty 综合项目运用
- android跨平台开发系列之-综合运用webview和html5结合(三)
- Repeater 嵌套用法
- 两个Repeater嵌套使用
- asp.net控件用法--在Repeater中嵌套使用Repeater
- Repeater 嵌套repeater输出不规则列表
- java.text和java.util的综合运用