当DropDownList绑定数据源后 需要手动添加一行数据 如“请选择”
private void BindFigureSort()
{
String sql = "SELECT [SortId],[SortName] FROM [dbo].[CV_FigureSort]";
DataSet ds = SqlHelper.ExecuteDataset(WebConfig.ConnStrWWW, CommandType.Text, sql);
ddlFigureSort.DataSource = ds;
ddlFigureSort.DataValueField = "SortId";
ddlFigureSort.DataTextField = "SortName";
ddlFigureSort.DataBind();
ListItem item = new ListItem();
item.Text = HttpUtility.HtmlDecode("(选择栏目)");
item.Value = "0";
ddlFigureSort.Items.Insert(0, item);
}
{
String sql = "SELECT [SortId],[SortName] FROM [dbo].[CV_FigureSort]";
DataSet ds = SqlHelper.ExecuteDataset(WebConfig.ConnStrWWW, CommandType.Text, sql);
ddlFigureSort.DataSource = ds;
ddlFigureSort.DataValueField = "SortId";
ddlFigureSort.DataTextField = "SortName";
ddlFigureSort.DataBind();
ListItem item = new ListItem();
item.Text = HttpUtility.HtmlDecode("(选择栏目)");
item.Value = "0";
ddlFigureSort.Items.Insert(0, item);
}