問題
使用 TableCell特性取GridView的BoundFiled欄位的值
解決方法
一個BoundFiled型態是一個TableCell,所以如果要從Gridview取得某row的某column的值時,可採用以下方式:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string name=(TableCell)e.Row.Cells[0]).Text;
}
}
沒有留言:
張貼留言