如何使用Asp,Net中的下拉列表更新一列 [英] How Do I Update One Column Using Dropdown In Asp,Net
问题描述
我在表中导入excel文件
现在我在该表中添加了一列,即年份
所以我的桌子就像是
slno name rollno year
1 abc 1111
2 bcs 1200
3 yry 2312
现在我需要填写年份直到填写数据桌子
使用下拉列表我想添加年份
如果我选择
2010-11
输出将是
slno name rollno year
1 abc 1111 2010-11
2 bcs 1200 2010-11
3 yry 2312 2010-11
i am importing excel file in a table
Now i have add one more column in that table i.e year
so my table is like
slno name rollno year
1 abc 1111
2 bcs 1200
3 yry 2312
now i need to populate the year till the data is filled in the table
Using dropdown i want to added the year
if i select
2010-11
output will be
slno name rollno year
1 abc 1111 2010-11
2 bcs 1200 2010-11
3 yry 2312 2010-11
推荐答案
在所选索引更改事件的帮助下获取下拉列表的值并更新您的表。
get the value of the dropdown with the help of selected index changed event and update your table.
DataTable workTable = new DataTable("Customers");
DataColumn workCol = workTable.Columns.Add("YEAR", typeof(Int32));
workCol.DefaultValue =dropdown.SelectedValue;
//bind gridview with workTable
这篇关于如何使用Asp,Net中的下拉列表更新一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!