开发者

how to add whole records of a field in DropDownList from database in asp.net with coding

开发者 https://www.devze.com 2022-12-19 10:48 出处:网络
Hi i want to add the particular 开发者_如何学编程field in dropdownlist by coding so hows that\'s possiblenot sure from your question, but I think you are looking for...

Hi i want to add the particular 开发者_如何学编程field in dropdownlist by coding so hows that's possible


not sure from your question, but I think you are looking for...

ListItem li = new ListItem();
    li.Text = "yourtext";
    li.Value = "yourvalue";
    li.Selected = true;
    yourDropdown.Items.Add(li);


if you mean a new item in drop-down list then use this:

ddList.Items.Add("Your New Item");

if you are using databinding with datatable having following fields:

Name, Age, ID 

then use this

dataTable.Rows.InsertAt(0,new object[]{"[Select]",0,-1});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号