using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace TowDropDownList
{
	/// <summary>
	/// TowDropDownList 的摘要说明。
	/// </summary>
	public class TowDropDownList : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Literal Want;
		protected System.Web.UI.WebControls.DropDownList SourceList1;
		protected System.Web.UI.WebControls.DropDownList DirectionList1;
		protected System.Web.UI.WebControls.DropDownList WantList1;
		protected System.Web.UI.WebControls.Literal Group;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
			{
				DataSet ds = new DataSet();
				ds.ReadXml(Server.MapPath("DataSource.xml"));
				for(int i = 0;i <ds.Tables[0].Rows.Count ;i++)
				{
					DataRow dr = ds.Tables[0].Rows[i];
					Want.Text += String.Format("Group[Groupcount++] = new Array(\"{0}\",\"{1}\",\"{2}\");\n", dr["v_Source"],dr["v_GroupName"].ToString(), dr["v_title"].ToString());
					if (SourceList1.Items.FindByText(dr["v_Source"].ToString()) == null)
					{
						SourceList1.Items.Add(dr["v_Source"].ToString());
					}
				}
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
