本文介绍了从下拉列表中的gridview中的行中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我从该行中触发一个dropbox selectedindexchange时,我试图从gridview中的一行获取一个特定的数据列...
我填充了grid和每个rown都有一个包含数据的下拉框,当我尝试更改该下拉值时,我想从该行获取'id'或'firstname'等。
我目前正在尝试这样的事情
Im trying to get a specific column of data from a row in a gridview when i fire a dropbox selectedindexchange from within that row...
I populate the grid and each rown has a dropdown box with data, when i try to change that dropdown value i want to get the 'id' or 'firstname' ect from that row.
Im currently trying something like this
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlCategory = (DropDownList)sender;
GridViewRow row = (GridViewRow)ddlCategory.NamingContainer;
int id = Convert.ToInt32(row.Cells[0]);
string name = Convert.ToString(row.Cells[1]);
}
推荐答案
这篇关于从下拉列表中的gridview中的行中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!