c# – gridview formatting – Education Career Blog

Can anybody help on this?

I have a grid populated with data from Database.Now to format the grid,I want some columns text alone to made Center(text alignment).How to do this dynamically?

,

GridViewId.Columns0.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

try this on page_load or any where.

,

I’m not sure if this is what you’re looking for :

yourGrid.ColumnsyourColumnIndex.DefaultCellStyle.Alignment = 
DataGridViewContentAlignment.MiddleCenter;

Leave a Comment