asp listview没有使用DataSourceID属性 [英] asp listview without using DataSourceID property

查看:88
本文介绍了asp listview没有使用DataSourceID属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,当listview使用codebehind中的DataSource属性进行绑定时,是否有人为我提供了如何处理listview事件的参考。我实现插入,更新等,但是当我点击编辑时它无法正常工作。

hello all, does any one give me reference for how to handle listview events when listview is binding using DataSource property in codebehind. I implement inserting,updating etc. but when i click on edit it does not work correctly.

<asp:ListView ID="listAllCourses" runat="server" InsertItemPosition="LastItem" DataKeyNames="BatchID"                                      OnItemCreated="listAllCourses_ItemCreated"                                    oniteminserting="listAllCourses_ItemInserting"                                     onitemediting="listAllCourses_ItemEditing">
<ItemTemplate>
                                        <tr>
                                            <td>
                                                <asp:Label runat="server" ID="lblId"><%#Container.DataItemIndex+1 %></asp:Label>
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblName"><%#Eval("Name") %></asp:Label>
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblType"><%#Eval("TotalSeats")%></asp:Label>
                                            </td>
                                            <td>
                                                <asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <td>
                                            <asp:Label runat="server" ID="lblId"><%#Container.DataItemIndex+1 %></asp:Label>
                                        </td>
                                        <td>
                                            <asp:Label runat="server" ID="lblName"><%#Eval("Name") %></asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtUpCtype" runat="server" Width="100px" Text='<%#Eval("TotalSeats") %>'></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:LinkButton ID="lnkUpdate" runat="server" CommandName="Update">Update</asp:LinkButton>
                                            <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                                            <asp:LinkButton ID="lnkCancel" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
                                        </td>
                                        </tr>
                                    </EditItemTemplate>
</asp:ListView>

推荐答案

这篇关于asp listview没有使用DataSourceID属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆