[ASP.net] GridView抓各Field值的方法
BoundField | e.Row.Cells[欄索引].Text |
CheckBoxField | CheckBox chk = (CheckBox)e.Row.Cells[欄索引].Controls[0]; |
HyperLinkField | HyperLink lnk = (HyperLink)e.Row.Cells[欄索引].Controls[0]; |
ImageField | Image img = (Image)e.Row.Cells[欄索引].Controls[0]; |
ButtonField | Button btn = (Button)e.Row.Cells[欄索引].Controls[0]; |
CommandField | 要視ButtonType(Button、Link、Image)決定 |
TemplateField | (控制項型別)e.Row.FindControl("控制項id"); |
from MSDN論壇:GridView 取值幾個問題