We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridGroupingControl - e.Style.HorizontalAlignment

Hi, I'm trying to center the contents of a particular cell in an ASP.NET GridGroupingControl through the OnQueryCellStyleInfo event.
However, the e.Style.HorizontalAlignment = GridHorizontalAlignment.Center is not working.
Is there an alternative way to center the contents of the cell? Thanks.


4 Replies

JA Janagan Syncfusion Team May 7, 2008 02:51 PM UTC

Hi,

You can center the contents of the cell by the custom css class through querycellstyleinfo event as mentioned in the code below:


Code Behind:

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{


e.Style.CssClass = "cellalign";

}

aspx:





Please refer the sample in the link below which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_Alignments/main.htm


Please try running the sample and let me know if this helps.

Regards,
Janagan.






- - May 8, 2008 08:44 AM UTC

It worked fine. Thanks a lot.



- - May 9, 2008 07:08 AM UTC

Thanks. That worked fine.



LH Lucie Houel December 3, 2008 10:57 AM UTC

Hi everyone,

I've got the same issue and the solution given works fine to me. The thing is that css properties are applied for all the row. How can I apply the css class for only one cell ?

Thanks a lot for the help.

LyLy


Loader.
Live Chat Icon For mobile
Up arrow icon