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

this.gridDataBoundGrid1.Model[cc.RowIndex, 2].CellType = "ComboBox";

Dear all,

i've write that code on CurrentCellChanged,but it doesnt work..


i want to set celltype of column at index 2 become combobox...

please advice..



3 Replies

JJ Jisha Joy Syncfusion Team February 12, 2008 08:49 AM UTC

Hi Sherly,

If you want to set the CellType of Coulmn at index to ComboBox, this can be achieved by the following code snippet:

this.gridDataBoundGrid1.Binder.InternalColumns[2].StyleInfo.CellType = "ComboBox";

Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/71743/main.htm

Kindly try this and let me know if you need further assistance.

Regards,
Jisha





SN Sherly Numawaty February 13, 2008 02:03 AM UTC

Hi Jisha

firstly thanks for ur response

actually, i've try ur code before, but it will be change the columns for all rows
the things what i'm trying to do is change columns on specific rowindex

i want to change for 1 row only...

is it possible?

fyi,i'm using vs2003

tx u so much,

sherly




SR SubhaSheela R Syncfusion Team February 13, 2008 09:24 AM UTC

Hi Sherly,

Thank you for using Syncfusion products.

In the GridDataBoundGrid Control, you cannot set cell specific properties like CellType, BackColor (other than CellValue or Text) using an indexer like this.gridDataBoundGrid[8,10].CellType = "ComboBox". The reason is that in GridDataBoundGrid, the only data storage is the bounded datasource. That only holds a single value. It does not hold CellType, Backcolor, or any of the other cell specific properties. So, in order to set cell specific properties like CellType in GridDataBoundGrid, you could handle the PrepareViewStyleInfo event or Model.QueryCellInfo event. Below is the code snippet:

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if (e.ColIndex == 2 && e.RowIndex == 2)
{
StringCollection items = new StringCollection();
items.Add("Apple");
items.Add("Grapes");
items.Add("Banana");
items.Add("Mango");
items.Add("Cherry");
e.Style.CellType = "ComboBox";
e.Style.BackColor = Color.LightBlue;
e.Style.ChoiceList = items;
}


Please refer to the sample available in the link below and let me know if it helps:

http://websamples.syncfusion.com/samples/Grid.Windows/F71743FollowUp /main.htm

Regards,
Subhasheela R



Loader.
Live Chat Icon For mobile
Up arrow icon