When we bind a data source to a GridView in asp.net, we often need to do some processing for each row. For example, we might need to change a row's background color based on some rules. GridView provides a RowDataBound event in which we can get the data of the row and do whatever required.
The event takes two parameters: RowDataBound(object sender, GridViewRowEventArgs e).
To determine if a row's type, we could use: if (e.Row.RowType == DataControlRowType.DataRow).
To get a field data for that row, we could use: string status = (string) DataBinder.Eval(e.Row.DataItem, "PropertyName").
Tuesday, 31 October 2006
Subscribe to:
Post Comments (Atom)
1 comment:
Thanks, it worked
Post a Comment