如何将select筛选出来的结果逐个添加到dropdownlist的item中去?谢谢!
解决方案 »
- 关于 邮件 验证 注册 的 奇怪现象????
- 加上“<!DOCTYPE html PUBLIC "-//W3C//DTD ....”后offsetWidth,offsetHeight等属性会错误。
- 母板页刷新问题。。 马上结贴
- 能否在一个普通的站点中创建几个ATLAS页面
- 高手请解答在repeater中按钮时常丢失事件的问题!
- <%#DataBinder.Eval(Container.DataItem,"AuthorName")%>问题,在线等待…………
- 初学者的疑问
- 插入语句的异常信息
- 请教一个ASP.net的问题,在线给分!!
- JSON序列化问题出在哪???
- 我想画一个会动 的 gif,或者png,用asp.net
- 自动提交表单,格式的问题!高手帮忙啊!
{
ListItem item = new ListItem();
item.Text = row["text"].ToString();
item.value = row["value"].ToString();
this.DDL1.Items.Add(item);
}
this.DropDownList.Items.Add(listitem);
其他一样啊.
{
if (!IsPostBack)
{
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["aaa"].ConnectionString))
{
SqlDataAdapter sda = new SqlDataAdapter("select CategoryID,CategoryName from Categories", connection);
DataSet ds = new DataSet();
sda.Fill(ds);
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "CategoryName";
DropDownList1.DataValueField = "CategoryID";
DropDownList1.DataBind();
}
}
}
{
this.DDL1.Items.Add(new ListItem(row["text"].ToString(),row["value"].ToString()));
}