2006-11-10
Asp.Net2.0 GridView RowDataBound用法
If e.Row.RowType = DataControlRowType.Header Then '指定需要修改的區段為header
e.Row.BackColor = Drawing.Color.Brown
End If
If e.Row.RowType = DataControlRowType.DataRow Then'指定需要修改的區段為資料
Dim price As Decimal = CType(DataBinder.Eval(e.Row.DataItem, "UnitPrice"), Decimal) '直接取得dataitem
Dim label1 As Label = CType(GridView1.FindControl("label1.text"), Label)
End If
If e.Row.RowType = DataControlRowType.Footer Then '指定需要修改的區段為footer
e.Row.Cells(4).Text = counter
End If
e.Row.BackColor = Drawing.Color.Brown
End If
If e.Row.RowType = DataControlRowType.DataRow Then'指定需要修改的區段為資料
Dim price As Decimal = CType(DataBinder.Eval(e.Row.DataItem, "UnitPrice"), Decimal) '直接取得dataitem
Dim label1 As Label = CType(GridView1.FindControl("label1.text"), Label)
End If
If e.Row.RowType = DataControlRowType.Footer Then '指定需要修改的區段為footer
e.Row.Cells(4).Text = counter
End If