我只是想做到怎么能将dropdownlist的内容显示出来
而我的dropdownlist的列的内容是我通过objectdatasource选择出来的

解决方案 »

  1.   

    DropDownList.DataSource = ObjectDataSource;
    DropDownList.DataTextField = "要绑定的Text列名称";
    DropDownList.DataValueField = "要绑定的Value列名称";
    DropDownList.DataBind();
      

  2.   

     /// <summary>
        /// 绑定工作流
        /// </summary>
        private void Bindflow()
        {
            string sql = "select FlowID,FlowName from FlowModelEx";
            DataSet ds = conn.getBinding(sql, "t1");
            ddlFlow.DataSource = ds.Tables["t1"];
            ddlFlow.DataTextField = ds.Tables["t1"].Columns["FlowName"].ToString();
            ddlFlow.DataValueField = ds.Tables["t1"].Columns["FlowID"].ToString();
            ddlFlow.DataBind();
        }
      

  3.   

    不是的你们误解我意思了可能我没有说清楚
    我DROPDOWNLIST的功能可以实现  
    但是我现在想做的就是把DROPDOWNLIST上的内容在页面上打印出来 
    就是用
     protected void Page_Load(object sender, EventArgs e)
        {
            response.write(DropDownList1.SelectedValue);
        }
    但是这个时候页面上没有显示DropDownList1项
      

  4.   

    我现在显示没问题 我要将dropdownlist的值输出来 打印 用response.write输出
      

  5.   

    protected void Page_Load(object sender, EventArgs e)
    {
            response.write(DropDownList1.SelectedValue);
    } 这样只能输出第一项,如果你的第一项是空的,那么输出就是空的!
      

  6.   

    dropdownlist控件动态加载的数据在提交时获取的值为空,可另加一隐藏控件,选择时用脚本将选定的值赋给隐藏控件,提交或显示时,从隐藏控件中取值