【发布时间】:2012-04-20 02:08:39
【问题描述】:
我正在使用 C# ASP.net,并且相对较新,需要完成以下操作。
在我的 VS2010 Web 应用程序项目中,我有 webform 和 Gridview,它从表中获取数据。
在网格中,我有 Commandfiled 按钮(column1)和带有Dropdownlist(column2)的项目模板。
用例是,用户首先从 3 个列表项(H、L 和 M)中选择一个 listitem,然后选择命令按钮。
我无法弄清楚如何从选定的行中提取选定的listitem
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView2.SelectedRow;
Label4.Text = "You selected " + row.Cells[4].Text + ".";
Label5.Text = "You selected this list item from dropdownlist " + ???? ;
}
提前致谢。
【问题讨论】:
标签: asp.net gridview itemtemplate html.dropdownlistfor