<%@ Register TagPrefix="Title" TagName="TitleShow" Src="/aspnetdata/Title.ascx" %>
<%@Import Namespace="System.Threading"%>
<%@Import Namespace="System.Globalization"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web" %>
<html>
  <script language="VB" runat=server>
	Dim Source as SqlConnection
	Dim d as string ="SELECT * from Orders"
	sub Page_Load(sender as object,e as EventArgs)
		Source = Ctype(Session("NowSTKSQL"),SqlConnection)
		if IsPostBack=false then
			Dim HT as Hashtable = new Hashtable()
			HT.Add("繁体中文", "zh-TW")
			HT.Add("简体中文", "zh-CN")
			HT.Add("日文", "ja-JP")
			HT.Add("英文-美国", "en-US")
			HT.Add("英文-英国", "en-GB")
			HT.Add("法文-法国", "fr-FR")
			HT.Add("德文-德国", "de-DE")
			AllLang.DataSource = HT
			AllLang.DataValueField="Value"
			AllLang.DataTextField="Key"
			AllLang.DataBind()
			bindNew(true)
		end if
	end sub
	sub bindNew(tag as Boolean)
		if tag=true then
			Dim DS as DataSet = new DataSet()
			Dim NComm as SqlDataAdapter = new SqlDataAdapter(d, Source)
			NComm.Fill(DS, "Orders")
			Orders.DataSource=DS.Tables("Orders").DefaultView
			Orders.DataBind()
			Session("NowAD")=DS'声明为Session
		else
			Dim DS as DataSet = Ctype(Session("NowAD"),DataSet)
			Orders.DataSource=DS.Tables("Orders").DefaultView
			Orders.DataBind()
		end if
	end sub
	sub ChangeLang(sender as Object,e as EventArgs)
		dim cult as CultureInfo'声明新语言
		cult = new CultureInfo(AllLang.SelectedItem.Value)
		Thread.CurrentThread.CurrentCulture = cult'更改语言
		bindNew(false)
	end sub
  </script>
<body background="/aspnetdata/images/winback.gif">
<Title:TitleShow id="BookT" Runat="server" />
    <form runat=server>
<asp:label id="rr" Runat="server" />
请选择语言：<asp:dropdownlist id="AllLang" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ChangeLang" />
<br>      <ASP:DataGrid id="Orders" runat="server"
        BorderColor="black"
        BorderWidth="1"
        GridLines="Both"
        CellPadding="3"
        CellSpacing="0"
        Font-Name="Verdana"
        Font-Size="10pt"
        HeaderStyle-BackColor="LightYellow"
	HeaderStyle-HorizontalAlign="Center"
	AutoGenerateColumns="FALSE"
	SelectedItemStyle-BackColor="#FFFFC0"
	ItemStyle-HorizontalAlign="right"
	EditItemStyle-HorizontalAlign="right"
	DataKeyField="OrderID"
>
      <Columns>
	<asp:TemplateColumn HeaderText="OrderID" >
		<ItemTemplate>
			<asp:Label runat="server" Text=<%# DataBinder.Eval(Container.DataItem, "OrderID") %> id="OrderID"/>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="OrderDate" >
		<ItemTemplate>
			<asp:Label runat="server" Text=<%# DataBinder.Eval(Container.DataItem, "OrderDate","{0:D}") %> id="OrderDate"/>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="Customer" >
		<ItemTemplate>
			<asp:Label runat="server" Text=<%# DataBinder.Eval(Container.DataItem, "CusID") %> id="CusID"/>
		</ItemTemplate>
	</asp:TemplateColumn>
	<asp:TemplateColumn HeaderText="TotalPrice" >
		<ItemTemplate>
			<asp:Label runat="server" Text=<%# DataBinder.Eval(Container.DataItem, "TotalPrice","{0:C}") %> id="Total"/>
		</ItemTemplate>
	</asp:TemplateColumn>
	</Columns>
</asp:DataGrid>
</form>