首页 > 代码库 > asp.net--ListView中ItemTemplate设置与功能按钮
asp.net--ListView中ItemTemplate设置与功能按钮
.aspx代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %> <!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> <style type="text/css"> .divItem{ padding:5px; } .divBtns{ width:130px; float:left;} .divInfo{ width:350px; padding:0px 10px 0px 10px; border-left:1px solid #dadada; border-right:1px solid #dadada; float:left;} .divInfo2{ width:200px; float:left;} .clr{ clear:both;} </style> </head> <body> <form id="form1" runat="server"> <div> <asp:listview ID="Listview1" runat="server" DataSourceID="AccessDataSource1" ItemPlaceholderID="itemHolder"> <LayoutTemplate> <div id="itemHolder" runat="server"> </div> </LayoutTemplate> <ItemTemplate> <div class="divItem"> <div class="divBtns"> <asp:Button ID="btn_edit" runat="server" Text="编辑" CommandName="edit"/><br /> <asp:Button ID="btn_delete" runat="server" Text="删除" CommandName="delete"/> </div> <div class="divInfo"> <h2><%#Eval("se_name") %></h2> <p><%#Eval("se_memo") %></p> </div> <div class="divInfo2"> <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%#Eval("se_enable") %>' Enabled="false" Text="有效性"/> <p>排序:<%#Eval("se_order") %></p> </div> <div class="clr"></div> </div> </ItemTemplate> </asp:listview> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/mdb/EV.mdb" DeleteCommand="DELETE FROM [T_SERIES] WHERE [se_id] = ?" InsertCommand="INSERT INTO [T_SERIES] ([se_id], [se_name], [se_memo], [se_order], [se_enable], [se_delete]) VALUES (?, ?, ?, ?, ?, ?)" SelectCommand="SELECT * FROM [T_SERIES]" UpdateCommand="UPDATE [T_SERIES] SET [se_name] = ?, [se_memo] = ?, [se_order] = ?, [se_enable] = ?, [se_delete] = ? WHERE [se_id] = ?"> <DeleteParameters> <asp:Parameter Name="se_id" Type="Int32" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="se_id" Type="Int32" /> <asp:Parameter Name="se_name" Type="String" /> <asp:Parameter Name="se_memo" Type="String" /> <asp:Parameter Name="se_order" Type="Int32" /> <asp:Parameter Name="se_enable" Type="Boolean" /> <asp:Parameter Name="se_delete" Type="Boolean" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="se_name" Type="String" /> <asp:Parameter Name="se_memo" Type="String" /> <asp:Parameter Name="se_order" Type="Int32" /> <asp:Parameter Name="se_enable" Type="Boolean" /> <asp:Parameter Name="se_delete" Type="Boolean" /> <asp:Parameter Name="se_id" Type="Int32" /> </UpdateParameters> </asp:AccessDataSource> </div> </form> </body> </html>
效果如下:
asp.net--ListView中ItemTemplate设置与功能按钮
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。