DataList my Example

Source: Internet
Author: User
Tags eval
Example <%@ 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>

<title>untitled page</title>
<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>
&LT;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= "



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.