DropDownList 加入行

添加人:guorui1314零级(46分)   添加时间:2008-05-28    阅读次数:412  收藏此教程
public void DropDownListInertRow()
    {
        string SqlStr = "select CategoryName from Categories";
        da = new SqlDataAdapter(SqlStr, con);
        da.Fill(ds, "Categories");
        DropDownList4.DataSource = ds.Tables["Categories"];
        DropDownList4.DataTextField = "CategoryName";
        DropDownList4.Items.Insert(0, "我会啦!HOHO");
        //下面这个方法也可以实现
        //DropDownList4.Items.Insert(0,new ListItem("0", "111"));
        DropDownList4.SelectedIndex = 0;
        DropDownList4.DataBind();
    }
1页 第1上一页1下一页
相关的教程: DropDownList 加入行
收藏此教程

当前平均分: 0.0(2 次打分)

-5-4-3-2-1012345
评论主题
您的大名
您的评论
验证码 点击换一个验证码
知识库搜索: