张亚运的专栏

Technology changes life,Code writes everything.

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>
   

效果如下:



阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yayun0516/article/details/41822301
个人分类: asp.net
上一篇asp.net二级菜单导航 实例
下一篇ListView中数据模板内的自定义按钮
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭