Hello,
I am using a gridDataBoundGrid wherein I have used a DataTable as the Datasource.I am not using any GridBoundColumns.How do I go about
setting Column styles(Readonly,HorizontalAlignment) for specific columns without using GridBoundColumns?
Is it possible to set Column styles(Readonly,HorizontalAlignment) for specific columns without mapping the DataColumns as GridBoundColumns?
JJ
Jisha Joy
Syncfusion Team
January 23, 2008 10:26 AM UTC
Hi Keshav,
Thank you for your interest in Syncfusion Products.
Please refer the following code snippets that shows how to set the Column styles(Readonly,HorizontalAlignment) for specific columns:
this.gridDataBoundGrid1.Binder.InternalColumns[0].StyleInfo.ReadOnly=true;
this.gridDataBoundGrid1.Binder.InternalColumns[0].StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Center;
Kindly try this and let me know if this helps.
Regards,
Jisha
KK
Keshav Kamat
January 29, 2008 01:09 PM UTC
Thanks a lot for your help. I am able to set these column styles but what about column widths?can i set column width without using gridboundcolumns?doesnt seem to work with
this.gridDataBoundGrid1.Model.ColWidths[0]= 100;
JJ
Jisha Joy
Syncfusion Team
January 30, 2008 05:17 AM UTC
Hi Keshav,
Thank you for your update.
You can set the ColWidths of specified column by handling the QueryColWidth event of GridDataBoundGrid.
Please refer the following code snippets:
this.gridDataBoundGrid1.Model.QueryColWidth += new GridRowColSizeEventHandler(Model_QueryColWidth);
void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
if (e.Index == 1)
{
e.Size = 10;
e.Handled = true;
}
}
Please let me know if this helps.
Regards,
Jisha