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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting Column Styles for GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

71240 Jan 23,2008 09:06 AM UTC Jan 30,2008 05:17 AM UTC Windows Forms 3
loading
Tags: GridControl
Keshav Kamat
Asked On January 23, 2008 09:06 AM UTC

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?


Jisha Joy [Syncfusion]
Replied On 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


Keshav Kamat
Replied On 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;



Jisha Joy [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;