public static class ExtendMethods
    {
        /// <summary>
        /// 绑定列表控件
        /// </summary>
        /// <param name="listControl">列表控件</param>
        /// <param name="dt">数据表</param>
        public static void BindListControl(this ListControl listControl, DataTable dt)
        {
            if (dt != null)
            {
                listControl.DataSource = dt;
                listControl.DataTextField = dt.Columns[1].Caption;
                listControl.DataValueField = dt.Columns[0].Caption;
                listControl.DataBind();
            }
        }
    }

 

相关文章:

  • 2021-12-10
  • 2021-10-13
  • 2022-01-14
  • 2021-12-26
  • 2022-12-23
  • 2021-11-28
  • 2021-12-03
  • 2021-08-02
猜你喜欢
  • 2022-01-03
  • 2022-01-04
  • 2021-11-29
  • 2021-06-16
  • 2022-12-23
  • 2021-10-08
相关资源
相似解决方案