Viewing source for recipe1308vb.aspx

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
	Dim dt as New DataTable("Contacts")
	dt.Columns.Add("UserID", System.Type.GetType("System.Int32"))
	dt.Columns.Add("FirstName", System.Type.GetType("System.String"))
	dt.Columns.Add("LastName", System.Type.GetType("System.String"))
	dt.Columns.Add("PhoneNo", System.Type.GetType("System.String"))
	dt.Columns("UserID").AutoIncrement = True

	Dim dr as DataRow

	dr = dt.NewRow()
	dr(1) = "John"
	dr(2) = "Doe"
	dr(3) = "555-555-5555"
	dt.Rows.Add(dr)
	dr = dt.NewRow()
	dr(1) = "Harry"
	dr(2) = "Smith"
	dr(3) = "555-444-4444"
	dt.Rows.Add(dr)
	dr = dt.NewRow()
	dr(1) = "Peter"
	dr(2) = "Rogers"
	dr(3) = "555-333-3333"
	dt.Rows.Add(dr)

	DataGrid1.DataSource = dt
	DataGrid1.DataBind()
End Sub
</script>
<form runat="server">
	<asp:DataGrid runat="server" id="DataGrid1" AutoGenerateColumns="False" ShowFooter="True">
		<Columns>
			<asp:TemplateColumn>
				<HeaderTemplate>
				Name
			</HeaderTemplate>
				<ItemTemplate>
					<asp:Label runat="server"
					Text='<%# Container.DataItem("FirstName") & " " & Container.DataItem("LastName") %>' />
				</ItemTemplate>
				<EditItemTemplate>
				First Name : <asp:TextBox runat="server"
						Text='<%# Container.DataItem("FirstName") %>' />
				<br>
				Last Name : <asp:TextBox runat="server"
						Text='<%# Container.DataItem("LastName") %>' />
			</EditItemTemplate>
				<FooterTemplate>
					<asp:HyperLink runat="server" Text="Go Home" NavigateUrl="default.aspx" />
				</FooterTemplate>
			</asp:TemplateColumn>
			<asp:BoundColumn HeaderText="Phone Number" DataField="PhoneNo" ReadOnly="False" DataFormatString="{0:N}" />
			<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Save" CancelText="Cancel" EditText="Edit" />
			<asp:ButtonColumn HeaderText="Remove Contact" ButtonType="LinkButton" Text="Remove" CommandName="RemoveContact" />
			<asp:HyperLinkColumn Text="View Contact Details" DataNavigateUrlField="UserID" DataNavigateUrlFormatString="userdetails.aspx?userid={0}" Target="_new" />
		</Columns>
	</asp:DataGrid>
</form>