我有一個GridView的數據。這個GridView的第一列是「SELECT」列。如何從ASP .NET中的GridVIew的SELECTED/HIGHLIGHTED行中提取特定值?
如果用戶點擊SELECT,它會突出顯示整行。
我對這個點擊操作的事件:
protected void gvShows_SelectedIndexChanged(object sender, EventArgs e)
{
}
基本上我想要做的是爲每個所選行,我要提取值的列:
- 數據源
- showId
- episodeId
這裏就是我遇到的問題:
string dataSource = "";
int showId = 0;
int episodeId = 0;
foreach (DataRow row in gvShows.Rows)
if (the row is selected/highlighted then...)
{
dataSource = the value under column "dataSrouce" for this ROW.
showId = the value under column "showId" for this ROW.
episodeId = the value under column "episodeId" for this ROW.
}
誰能給我這個忙嗎?
我明天試試這個。謝謝! –