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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Celltype for specific column with specific rowindex in griddataboundgrid

Thread ID:





71737 Feb 12,2008 02:42 AM UTC Feb 13,2008 09:17 AM UTC WinForms 1
Tags: GridControl
Sherly Numawaty
Asked On February 12, 2008 02:42 AM UTC

i'm using vs2003, i'm trying to set celltype of a specific column
i'm using this code :"grid1.Binder.InternalColumns[colIndex].StyleInfo.CellType="ComboBox";"
on CurrentCellChanged event

it has changed.
but i just want to change celltype of column on row which selected by user.

please advice


Jeba S [Syncfusion]
Replied On February 13, 2008 09:17 AM UTC

Hi Sherly,

Thank you for your interest in Syncfusion Products.

Swapping out a cell control while the cell is the active cell is problematic. If it is not the active cell, you could subscribe to the Model.QueryCellInfo event and set e.Style.CellType depending upon whether e.RowIndex was the grid.CurrentCell.RowIndex and if e.ColIndex pointed to the column.

In a GridDataBoundGrid, you cannot set cell specific properties like BackColor, CellType (other than CellValue or Text) using an indexer like this.gridDataBoundGrid[8,10].BackColor=Color.Red. The reason is that in a GridDataBoundGrid, the only data storage is the bound datasource. That only holds a single value. It does not hold TextColor, or Backcolor, or any of the other many cell specific properties. So, in order to set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style to the value you want.

this.gridDataBoundGrid1.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (e.RowIndex > 0 && e.ColIndex > && e.ColIndex==1 && e.RowIndex==2)
e.Style.CellType = GridCellTypeName.ComboBox;

Kindly let us know if you need any further assistance.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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