首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

简单有关问题 问下大家

2012-01-08 
简单问题 问下大家数据库提出stringa 款式:大,小,中 如何在下拉菜单中显示只大中小[解决办法]protecte

简单问题 问下大家
数据库提出
string   a= "款式:大,小,中 ";
如何在下拉菜单中显示只




[解决办法]
protected void Page_Load(object sender, EventArgs e)
{
string a = "款式:大,中,小 ";
string[] b = a.Split( ': ');
string[] c = b[1].Split( ', ');
CheckBoxList CBL = new CheckBoxList();
CBL.ID = "CBL ";
CBL.DataSource = c;
CBL.DataBind();
DropDownList DDL = new DropDownList();
DDL.DataSource = c;
DDL.DataBind();
this.Form.Controls.Add(CBL);
this.Form.Controls.Add(DDL);
}

protected void Button1_Click(object sender, EventArgs e)
{
CheckBoxList CBL = (CheckBoxList)this.Form.FindControl( "CBL ");
foreach (ListItem LI in CBL.Items)
{
if (LI.Selected)
Response.Write(LI.Text);
}

}

热点排行