DataList嵌套实例[4]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

        private void BindData()
        {
            string commandText = "select * from ArticleType";
            //----------
            OleDbConnection conn = new OleDbConnection();
            conn.ConnectionString = connString;
            conn.Open();
            OleDbDataAdapter da = new OleDbDataAdapter(commandText,conn);
            DataSet ds = new DataSet();
            da.Fill(ds,"ArticleType");
            conn.Close();
            //----------
            DataList1.DataSource = ds.Tables["ArticleType"];
            DataList1.DataBind(); 
        }

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

        }
        #endregion

本文关键:DataList嵌套实例
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top