datalist我的樣本

來源:互聯網
上載者:User
樣本 <%@ 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">
<SelectedItemTemplate>
ID:
<asp:Label ID="Label1" Runat="server" Text='<%# Eval("ID") %>'></asp:Label> 
<br />
art_title:
<asp:Label ID="Label2" Runat="server" Text='<%# Eval("art_title") %>'></asp:Label><br />
IP:
<asp:Label ID="Label3" Runat="server" Text='<%# Eval("IP") %>'></asp:Label>
<asp:LinkButton ID="LinkButton2" Runat="server" CommandName="cancel">return</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" Runat="server" CommandName="edit">edit</asp:LinkButton>
<br />
<br />
</SelectedItemTemplate>
<ItemTemplate>
ID:
<asp:Label ID="IDLabel" Runat="server" Text='<%# Eval("ID") %>'></asp:Label>
<asp:LinkButton ID="LinkButton1" Runat="server" >more</asp:LinkButton>
<br />
<br />
</ItemTemplate>
<EditItemTemplate>
ID:  
<asp:TextBox ID="TextBox1" Runat="server" Text='<%# Eval("ID") %>'></asp:TextBox>
<br />
art_title: 
<asp:TextBox ID="TextBox2" Runat="server" Text='<%# Eval("art_title") %>'></asp:TextBox>
<br />
IP: 
<asp:TextBox ID="TextBox3" Runat="server" Text='<%# Eval("IP") %>'></asp:TextBox>
<br /><asp:LinkButton ID="LinkButton3" Runat="server">CANCER</asp:LinkButton>
<asp:LinkButton ID="LinkButton5" Runat="server">SUBMIT</asp:LinkButton>
<br />
</EditItemTemplate>
</asp:DataList>
<asp:AccessDataSource ID="AccessDataSource1" Runat="



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。