如:DropDownList1.Items.Add(new ListItem("已添加的用户等级"));
DropDownList1.DataSource = db;
DropDownList1.DataTextField = "UserClass";
DropDownList1.DataValueField = "UserClass";
DropDownList1.DataBind();效果是:已添加的用户等级
下面是读出的数据项
DropDownList1.DataSource = db;
DropDownList1.DataTextField = "UserClass";
DropDownList1.DataValueField = "UserClass";
DropDownList1.DataBind();效果是:已添加的用户等级
下面是读出的数据项
解决方案 »
- 高手们遇到过这个问题吗?找不到元素httpErrorPageScripts.js
- 把电脑修好了,希望也能修好其他的问题_2009年了,散100分_祝各位心情愉快
- Request.QueryString得不到值
- 基础平台管理系统(FrameWork) 1.0.0 Release 发布
- asp.net中的加密?--
- || 如何给绑定后的DataList进行排序 谢谢
- runat=server是什么意思
- 难题求教: 如何由字符串, 转换成控件对象, 第一次碰到这样的需求, 头麻!!! 谢谢!!!
- 关于在datagrid中HyperLinkColumn列中的二个及以上参数传递的方式!(在线等)
- 怎样在前端web页面上更改web.config中的配置信息?
- C/S自定义打印报表,思归、孟子以及各位大虾帮帮忙!俺在线等
- 今天把我的收藏夹全部放出来了,希望对初学的朋友有所帮助。
DropDownList1.DataTextField = "UserClass";
DropDownList1.DataValueField = "UserClass";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0,new ListItem("已添加的用户等级","-1"));
DropDownList2.DataTextField="CategoryName";
DropDownList2.DataValueField="CategoryId";
DropDownList2.DataBind();
ListItem IT=new ListItem(); //增加一个空白项,并使之位于首位。
IT.Selected=true;
DropDownList2.Items.Add(IT);
dr["field1"] = ...;
dr["field2"] = ...;
dataset.table.Rows.InsertAt(dr,0);databind();