婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > asp.net 數(shù)據(jù)綁定的實例代碼

asp.net 數(shù)據(jù)綁定的實例代碼

熱門標簽:辦理400電話證件 巫師3為什么地圖標注的財寶沒有 怎么給超市做地圖標注入駐店 外呼系統(tǒng)費用一年 外呼系統(tǒng)代理品牌 十堰正規(guī)電銷機器人系統(tǒng) 寧波自動外呼系統(tǒng)代理 手機地圖標注如何刪除 世紀佳緣地圖標注怎么去掉
復制代碼 代碼如下:

public partial class _Default : System.Web.UI.Page
{
    protected string title="大家好";            //前臺代碼title>%#title %>/title>
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();
        string sql = ConfigurationManager.ConnectionStrings["strsql"].ConnectionString;
        using (SqlConnection sqlCnn=new SqlConnection(sql))
        {
            using (SqlCommand sqlCmm=sqlCnn.CreateCommand())
            {
                sqlCmm.CommandText = "select * from List";
                SqlDataAdapter adapter = new SqlDataAdapter(sqlCmm);
                adapter.Fill(ds);
            }
            this.RadioButtonList1.DataSource = ds.Tables[0];
            this.RadioButtonList1.DataTextField = "listname";
            this.RadioButtonList1.DataValueField = "id";
            //this.RadioButtonList1.DataBind();
            this.CheckBoxList1.DataSource = ds.Tables[0];
            this.CheckBoxList1.DataTextField = "listname";
            this.CheckBoxList1.DataValueField = "id";
            //this.RadioButtonList1.DataBind();
            this.DataBind();
        }            //數(shù)據(jù)綁定到RadioButtonList,CheckBoxList
        if (!IsPostBack)
        {
            DataSet ds1 = new DataSet();
            using (SqlConnection sqlCnn1 = new SqlConnection(sql))
            {
                using (SqlCommand sqlCmm1 = sqlCnn1.CreateCommand())
                {
                    sqlCmm1.CommandText = "select provinceid,provincename from Province";
                    SqlDataAdapter adapter = new SqlDataAdapter(sqlCmm1);
                    adapter.Fill(ds1);
                    this.DropDownList1.DataSource = ds1.Tables[0];
                    this.DropDownList1.DataTextField = "provincename";
                    this.DropDownList1.DataValueField = "provinceid";
                    this.DropDownList1.DataBind();
                }
            }
        }
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();
        string str = ConfigurationManager.ConnectionStrings["strsql"].ConnectionString;
        using (SqlConnection sqlCnn = new SqlConnection(str))
        {
            using (SqlCommand sqlCmm = sqlCnn.CreateCommand())
            {
                sqlCmm.CommandText = "select cityid,cityname from City where provinceid='" + this.DropDownList1.SelectedValue + "'";
                SqlDataAdapter adapter = new SqlDataAdapter(sqlCmm);
                adapter.Fill(ds);
                this.DropDownList2.DataSource = ds.Tables[0];
                this.DropDownList2.DataTextField = "cityname";
                this.DropDownList2.DataValueField = "cityid";
                this.DropDownList2.DataBind();
            }
        }
    }//實現(xiàn)省市二級聯(lián)動
}
您可能感興趣的文章:
  • asp.net Repeater 數(shù)據(jù)綁定的具體實現(xiàn)(圖文詳解)
  • ASP.NET Eval進行數(shù)據(jù)綁定的方法
  • asp.net的cms 綁定數(shù)據(jù)篇
  • asp.net Repeater 數(shù)據(jù)綁定代碼
  • asp.net ListView 數(shù)據(jù)綁定

標簽:天門 牡丹江 平涼 景德鎮(zhèn) 山西 通遼 嘉興 泰州

巨人網絡通訊聲明:本文標題《asp.net 數(shù)據(jù)綁定的實例代碼》,本文關鍵詞  asp.net,數(shù)據(jù),綁,定的,實例,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《asp.net 數(shù)據(jù)綁定的實例代碼》相關的同類信息!
  • 本頁收集關于asp.net 數(shù)據(jù)綁定的實例代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 石林| 抚顺县| 靖边县| 吉林省| 恭城| 金阳县| 永清县| 德令哈市| 彭水| 红河县| 苗栗县| 邵东县| 策勒县| 渝北区| 修武县| 阳谷县| 江源县| 内黄县| 达日县| 扎赉特旗| 闽侯县| 上高县| 乌海市| 汤原县| 周宁县| 孟村| 建水县| 鞍山市| 阳原县| 景洪市| 阜阳市| 平凉市| 伊川县| 黔东| 东丰县| 永和县| 彰化市| 临漳县| 东丰县| 桦川县| 庆城县|