标题:如何在ListView上增加编辑功能?
只看楼主
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1817
专家分:3681
注 册:2011-3-24
结帖率:98.24%
 问题点数:0 回复次数:0 
如何在ListView上增加编辑功能?
虽然UI内建向导可以自动产生有编修功能的ListView
但是写法和我的差蛮多的~只需编辑和更新栏位功能~
请教高手如何把我的Code改成有编辑栏位功能

程序代码:
<asp:Panel ID="pnlQueryResult" runat="server" Visible="false">
    <div align="right">
        <asp:LinkButton ID="lkbExcel" runat="server" Text="汇出Excel" Font-Underline="True" />&nbsp;&nbsp;
    </div>
    <h4>
        <asp:Label ID="lblTitleEng" runat="server" />
    </h4>
    <h3>
        <asp:Label ID="lblTitleChi" runat="server" />
    </h3>
    <table width="711px" cellpadding="0">
        <tr class="Project_Header">
            <td style="table-layout: fixed; width: 40px" align="center">
                姓名
            </td>
            <td width="70px">
                课程类别
            </td>
            <td>
                课程名称
            </td>
            <td width="65px">
                开始时间
            </td>
            <td width="65px">
                结束时间
            </td>
            <td width="65px">
                观看时间
            </td>
            <td width="65px">
                观看次数
            </td>
            <td width="65px">
                成绩
            </td>
            <td width="40px">
                Edit
            </td>
        </tr>
    </table>
    <div style="max-height: 550px; overflow: auto; float: left; width: 100%;">
        <asp:ListView ID="ListView1" runat="server">
            <LayoutTemplate>
                <table width="711px" cellpadding="0">
                    <asp:PlaceHolder runat="server" ID="itemPlaceholder" />
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr class="Course_Item" align="center">
                    <td style="table-layout: fixed; width: 40px" align="center">
                        <asp:Label ID="lblUserNo" runat="server" Font-Size="10px" Text='<%# GetEmployeeName(Eval("UserID"))%>' ToolTip='<%# Eval("UserID")%>' />
                    </td>
                    <td width="80px" align="center">
                        <asp:Label ID="FileName" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# Eval("ClassID")%>' />
                    </td>
                    <td align="left">
                        <asp:Label ID="FileMemo" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# GetClassName(0,Eval("ClassID"),Eval("SubClassID"),Eval("FileNo"))%>' ToolTip='<%# GetClassName(1, Eval("ClassID"), Eval("SubClassID"), Eval("FileNo"))%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblStartDate" runat="server" Font-Size="10px" Text='<%# DataBinder.Eval(Container.DataItem, "StartDate", "{0:yyyy/MM/dd}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblDeadline" runat="server" Font-Size="10px" Text='<%# DataBinder.Eval(Container.DataItem, "EndDate", "{0:yyyy/MM/dd}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblWatchtime" runat="server" Font-Size="10px" Value='<%# DataBinder.Eval(Container.DataItem, "StudyTime", "{0:d}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblControlNoName" runat="server" Font-Size="10px" Value='<%# DataBinder.Eval(Container.DataItem, "StudyCount", "{0:d}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="Lblscore" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# Bind("Results")%>' />
                    </td>
                    <td width="20px" align="center">
                        <asp:Button ID="btnView" runat="server" Text="维护"  CommandName="Edit" Font-Size="10px" />
                    </td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr class="Course_Item" align="center">
                    <td style="table-layout: fixed; width: 40px" align="center">
                        <asp:Label ID="lblUserNo" runat="server" Font-Size="10px" Text='<%# GetEmployeeName(Eval("UserID"))%>' ToolTip='<%# Eval("UserID")%>' />
                    </td>
                    <td width="80px" align="center">
                        <asp:Label ID="FileName" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# Eval("ClassID")%>' />
                    </td>
                    <td align="left">
                        <asp:Label ID="LinkButton1" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# GetClassName(0, Eval("ClassID"), Eval("SubClassID"), Eval("FileNo"))%>'  ToolTip='<%# GetClassName(1, Eval("ClassID"), Eval("SubClassID"), Eval("FileNo"))%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblKickOffDate" runat="server" Font-Size="10px" Text='<%# DataBinder.Eval(Container.DataItem, "StartDate", "{0:yyyy/MM/dd}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblDeadline" runat="server" Font-Size="10px" Text='<%# DataBinder.Eval(Container.DataItem, "EndDate", "{0:yyyy/MM/dd}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblWatchtime" runat="server" Font-Size="10px" Value='<%# DataBinder.Eval(Container.DataItem, "StudyTime", "{0:d}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblControlNoName" runat="server" Font-Size="10px" Value='<%# DataBinder.Eval(Container.DataItem, "StudyCount", "{0:d}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="Lblscore" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# Bind("Results")%>' />
                    </td>
                    <td width="20px" align="center">
                        <asp:Button ID="btnView" runat="server" Text="维护"  CommandName="Edit" Font-Size="10px" />
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <ItemTemplate>
                <tr class="Course_Item" align="center">
                    <td style="table-layout: fixed; width: 40px" align="center">
                        <asp:Label ID="lblUserNo" runat="server" Font-Size="10px" Text='<%# GetEmployeeName(Eval("UserID"))%>' ToolTip='<%# Eval("UserID")%>' />
                    </td>
                    <td width="80px" align="center">
                        <asp:Label ID="FileName" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# Eval("ClassID")%>' />
                    </td>
                    <td align="left">
                        <asp:Label ID="LinkButton1" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# GetClassName(0, Eval("ClassID"), Eval("SubClassID"), Eval("FileNo"))%>'  ToolTip='<%# GetClassName(1, Eval("ClassID"), Eval("SubClassID"), Eval("FileNo"))%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblKickOffDate" runat="server" Font-Size="10px" Text='<%# DataBinder.Eval(Container.DataItem, "StartDate", "{0:yyyy/MM/dd}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblDeadline" runat="server" Font-Size="10px" Text='<%# DataBinder.Eval(Container.DataItem, "EndDate", "{0:yyyy/MM/dd}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblWatchtime" runat="server" Font-Size="10px" Value='<%# DataBinder.Eval(Container.DataItem, "StudyTime", "{0:d}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="lblControlNoName" runat="server" Font-Size="10px" Value='<%# DataBinder.Eval(Container.DataItem, "StudyCount", "{0:d}")%>' />
                    </td>
                    <td width="65px" align="center">
                        <asp:Label ID="Lblscore" runat="server" Font-Size="10px" ForeColor="#CC0066" Text='<%# Bind("Results")%>' />
                    </td>
                    <td width="20px" align="center">
                        <asp:Button ID="btnView" runat="server" Text="维护"  CommandName="Edit" Font-Size="10px" />
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
    <div>
</asp:Panel>
<!-- ▲▲课程查询-指定范围清单列表▲▲ -->


[此贴子已经被作者于2017-6-6 16:40编辑过]

搜索更多相关主题的帖子: asp server align Label center 
2017-06-06 16:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-477690-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021989 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved