如何在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" /> </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编辑过]