GridView RowDataBound Get DataSource By Row

When using RowDataBound (the GridView’s method) and want to get the data by row. Because RowDataBound work on row by row when initial GridView. How to get data from datasource in method RowDataBound ? Use Eval() method will help you

protected void gvView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
_SumTotal += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, “Total”));
}
}

// “Total” is a data field in database
// _SumTotal is a global valuable on this page

In this example you can get all total summary in gridview datasource.