<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "content") %>
<%# DataBinder.Eval(Container.DataItem, "title") %>
<asp:ImageButton id="ImageButton1" runat="server"></asp:ImageButton>
</ItemTemplate>
</asp:Repeater>
---------------------
读出N条记录 没条记录有个按纽
想单击该按纽 删除记录 不知如何实现
以前都是 连接到另外一个文件del.aspx?id=id这样
现在想直接删除 不知?
(不习惯用datagrid)
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "content") %>
<%# DataBinder.Eval(Container.DataItem, "title") %>
<asp:ImageButton id="ImageButton1" runat="server"></asp:ImageButton>
</ItemTemplate>
</asp:Repeater>
---------------------
读出N条记录 没条记录有个按纽
想单击该按纽 删除记录 不知如何实现
以前都是 连接到另外一个文件del.aspx?id=id这样
现在想直接删除 不知?
(不习惯用datagrid)
<asp:ButtonColumn Text="删除" CommandName="Delete"></asp:ButtonColumn>
在DeleteCommand事件中处理
ibDelete.CommandName = "Recycled";在ItemCommand中if(e.CommandName == "Recycled")
{
delete.......
}
那根据什么删除该记录呢?
不愿用DATAGRID的BUTTON列按楼上方法<asp:DataList id="DataList1" runat="server" DataKeyField="id" OnItemCommand="MyDataGrid_Delete">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "time_data") %>
<asp:Button id="Button1" runat="server" CommandName="Delete" Text="Button"></asp:Button>
</ItemTemplate>
</asp:DataList>
-------------
public void MyDataGrid_Delete(Object sender, DataListCommandEventArgs e)
{
if(e.CommandName=="Delete")
{删除记录
} }
但是没有反映