本帖最后由 宋兴征 于 2013-4-3 22:07 编辑
数据源绑定:- <asp:ObjectDataSource ID="odsDelRight" runat="server" DeleteMethod="Delete" SelectMethod="GetAllRights"
- TypeName="TMCR.BLL.RightBLL">
- <DeleteParameters>
- <asp:Parameter Name="rightId" Type="Int32" />
- </DeleteParameters>
- </asp:ObjectDataSource>
复制代码 ListView代码:- <asp:ListView ID="lvDelRight" runat="server" DataSourceID="odsDelRight"
- onitemdeleting="lvDelRight_ItemDeleting"
- onitemdatabound="lvDelRight_ItemDataBound">
- <ItemTemplate>
- <tr >
- <td width="6%">
- <%# Eval("Id") %>
- </td>
- <td width="10%">
- <%# Eval("Name") %>
- </td>
- <td width="28%">
- <%# Eval("Url") %>
- </td>
- <td width="10%">
- <asp:Label ID="lblPID" runat="server" Text="Null"></asp:Label>
- </td>
- <td width="10%">
- <%# Eval("NameSpace") %>
- </td>
- <td width="6%">
- <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="删除" />
-
- </td>
- </tr>
- </ItemTemplate>
复制代码 ItemDeleting事件:- protected void lvDelRight_ItemDeleting(object sender, ListViewDeleteEventArgs e)
- {
-
- }
复制代码 在删除时,将当前对象id传给Delete(int rightId)方法,然后完成删除操作。
怎么去做?
|