Asp.net中CheckBox控制GridView

首先在添加引用using System.Text.RegularExpressions;

(!IsPostBack)声明一个函数

if (!IsPostBack)
{

DropDownList1_Binding();

{

在最后面添加以下代码

 

private void DropDownList1_Binding()
{
this.DropDownList1.DataSource = GetData().Select(yn => new { value = yn }).ToList();
this.DropDownList1.DataTextField = "value";
this.DropDownList1.DataBind();
}

private List<string> GetData()
{
List<string> yn = new List<string>();
yn.Add("xxx");
yn.Add("xxx");
return yn;
}

posted @ 2015-09-07 15:59  阳阳1998  阅读(104)  评论(0编辑  收藏  举报