<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat="server"> Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) If e.CommandSource.ID = "LinkButton1" Then DataList1.SelectedIndex = e.Item.ItemIndex ' ElseIf e.CommandSource.ID = "LinkButton2" Then ' ElseIf e.CommandSource.ID = "LinkButton4" Then ' DataList1.EditItemIndex = e.Item.ItemIndex ElseIf e.CommandSource.ID = "LinkButton3" Then DataList1.EditItemIndex = -1 ElseIf e.CommandSource.ID = "LinkButton5" Then Response.Write("hello") End If DataList1.DataBind() End Sub Sub DataList1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) DataList1.EditItemIndex = e.Item.ItemIndex DataList1.DataBind() End Sub Sub DataList1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Response.Write("this is test..................dingding") DataList1.SelectedIndex = -1 DataList1.DataBind() End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DataList ID="DataList1" Runat="server" DataKeyField="ID" DataSourceID="AccessDataSource1" OnItemCommand="DataList1_ItemCommand" OnEditCommand="DataList1_EditCommand" OnCancelCommand="DataList1_CancelCommand"> |