当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);
    }

posted @ 2009-12-15 14:57  不必太用力  阅读(628)  评论(0编辑  收藏  举报