zoukankan      html  css  js  c++  java
  • ASPxComboBox下拉列表数据绑定

    public partial class app_BridgeInfo : System.Web.UI.Page
    {
        private string opt; //操作类型   add:添加  update:修改
        private string id;  //ID

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Response.Expires = -1;  //取消该页缓存
                opt = Request.QueryString["opt"] != null ? Request.QueryString["opt"].ToString() : "";
                id = Request.QueryString["id"] != null ? Request.QueryString["id"].ToString() : "0";

                if (id == "")
                {
                    CommonJS.AlertMessage(this.Page, "操作错误!", "0");
                }

                HFID.Value = id;
                Handler();
                BindDate();
            }
        }

     


    /// <summary>
        /// 绑定下拉列表信息
        /// </summary>
        /// <param name="id"></param>

        private void BindDate()
        {
            lbCode.DataSource = BLLBridge.Select();
            lbCode.TextField = "Name";
            lbCode.ValueField = "Code";
            lbCode.DataBind();


          }

    或:


       protected void Page_Load(object sender, EventArgs e)

        {

            if (!Page.IsPostBack) ;

            {

                bindTitle();

            }

        }

        //进行数据绑定

        private void bindTitle()

        {//对一个下拉列表的数据绑定

            DB dbSource = new DB();

            SqlDataReader dateSoure = dbSource.getSdr("select id,voteTitle from voteMaster");

            this.ddlVoteTitle.DataSource = dateSoure;

            this.ddlVoteTitle.DataValueField = "id";

            this.ddlVoteTitle.DataTextField = "voteTitle";

            this.ddlVoteTitle.DataBind();

        }


    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/meng1986/archive/2007/08/04/1726332.aspx

  • 相关阅读:
    001 数电 (1) : 数制和码制
    js页面滚动浮动层智能定位(MooTools)实例页面
    Value  of type java.lang.String cannot be converted to JSONObject 错误解决
    关于线程池的shutdown()方法
    Can't create handler inside thread that has not called Looper.prepare()
    配置 Win7 和 IIS7 以支持WCF
    复制JSON对象
    js页面滚动浮动层智能定位(jQuery)实例页面
    Enum和string的相互转换
    TBCompressor 2.4.2修改版,可对目录中的JS/CSS文件进行压缩
  • 原文地址:https://www.cnblogs.com/lizhao/p/1534823.html
Copyright © 2011-2022 走看看