By default ASP.NET GridView Columns has left alignment text. We can use GridView ItemStyle property with either of GridView BondField or Template Field to change the default alignments.GridView properties,
ItemStyle-HorizontalAlign having few set of values, using which we can change the alignments.
Above customization is true when you are using Bound Field or Template Field for binding the data . But If you want to customize the same set alignments for data source which are directly binding with GridView you have to use
Gridview_PreRender methods .
Let’s say you are binding below set of records directly with gridview
As the above set of records binded without any data bound field, you have to override the RowDataBound Event to set the alignment.
DataControlRowType enum having the similar values as
Similarly you can override the same thing in
GridView_PreRender Method as well