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

changing celltype dynamically

I have a GDBG control. I need to change the celltype for each row based on a selection made in the contextmenu attached to the Grid. The celltype could be either a TextBox or a ComboBox Type. How can I change it. Please help me.

13 Replies

AD Administrator Syncfusion Team November 23, 2006 10:25 AM UTC

Hi Vijayaraghavan,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check ComboHashTable entries and set the e.Style.CellType to the value you want. Please refer to the attached sample for implementation.

Sample : GDBGRowCellType.zip

Best Regards,
Haneef


VI vijayaraghavan November 24, 2006 06:30 AM UTC

Hi Haneef

On selection made in the context menu the entire row celltype is changed. How can I change a cell in a row to the specified celltype.



>Hi Vijayaraghavan,

To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check ComboHashTable entries and set the e.Style.CellType to the value you want. Please refer to the attached sample for implementation.

Sample : GDBGRowCellType.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 24, 2006 08:48 AM UTC

Hi Vijayaraghavan,

Thanks for the update.

Please try the attached sample and let me know if you are looking something different.
GDBGChangeType.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 24, 2006 11:31 AM UTC

Thanks Haneef

I could change the celltype to Combo/Text. I assign the datasource as it has been given in the sample. But couldn't have the data populated in the Combo.

Please advise me how to do this.

Sorry for the inconvenience.


AD Administrator Syncfusion Team November 25, 2006 05:15 AM UTC

Hi Haneef

Thanks for your support. When changing the celltype dynamically to Combo/Text using context menu.It works. The celltype get changed but the datasource properties assigned does not populate values to the Combo.

I could not have that part working in the sample you provided as well. How can I go about doing that?

Thanks
Vijayaraghavan


AD Administrator Syncfusion Team November 27, 2006 04:32 AM UTC

Hi Vijayaraghavan,

Use the below code snippet to resolve the issue.

private void menuItem2_Click(object sender, System.EventArgs e)
{
GridCurrentCell cc =this.gridDataBoundGrid1.CurrentCell ;
ComboxHashTable[GetHashCode(cc.RowIndex,cc.ColIndex)] = true;
cc.IsModified = true;
this.gridDataBoundGrid1.RefreshRange( GridRangeInfo.Row(cc.RowIndex));
cc.EndEdit();
cc.MoveTo(cc.RowIndex,cc.ColIndex,GridSetCurrentCellOptions.SetFocus);
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GDBGChangeType_d38cb4e.zip

Best Regards,
Haneef


VI vijayaraghavan November 27, 2006 05:28 AM UTC

Hi Haneef

Thanks for you reply. I could not have the value displayed in the ComboBox when I dynamically change the cell to Combo. I assign the DataSource,DisplayMember,ValueMember but I couldn't have data shown in Combo. The cell gets changed to Combo but not populated with the assigned DataSource.

Sorry to trouble you much on this regard.

Thanks
Vijayaraghavan



AD Administrator Syncfusion Team November 27, 2006 07:21 AM UTC

Hi Vijayaraghavan,

Thanks for the update.

Is it possible for you to upload us more details/sample or modify the attached sample to reproduce the issue here? This will help us to analyse the issue further.

Sample : GDBGChangeType.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 27, 2006 08:50 AM UTC

Hi Vijayaraghavan,

Thanks for the update.

Is it possible for you to upload us more details/sample or modify the attached sample to reproduce the issue here? This will help us to analyse the issue further.

Sample : GDBGChangeType.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team November 27, 2006 09:05 AM UTC

Hi Haneef

Our scenario totally matches with the sample you provided. I am using Syncfusion 1.6.1.5 and I run your sample with just two references Syncfusion.Grid and Syncfusion.Shared.

Is this anything to do with not populating values in the Combo when cell style is changed in PrepareViewStyleInfo event and datasource is assigned.

Thanks
Vijayaraghavan


VI vijayaraghavan November 27, 2006 10:16 AM UTC

Hi Haneef

Our scenario totally matches with the sample you provided. I am using Syncfusion 1.6.1.5 and I run your sample with just two references Syncfusion.Grid and Syncfusion.Shared.

Is this anything to do with not populating values in the Combo when cell style is changed in PrepareViewStyleInfo event and datasource is assigned.

Thanks
Vijayaraghavan


AD Administrator Syncfusion Team November 27, 2006 11:54 AM UTC

Hi Vijayaraghavan,

You can use the Model.TableStyle property to store the datasource of the cell in a grid and change the celltype of the cell using PrepareViewStyleInfo/Model.QueryCellInfo event. Please refer to the attached sample for implementation and let me know if this helps.

Here is a sample.
GDBGChangeType.zip

Best Regards,
Haneef


VI vijayaraghavan November 27, 2006 02:52 PM UTC

Hi Haneef

Thanks a lot. It has been a great support from your side.

Thanks Again
Vijayaraghavan

Loader.
Live Chat Icon For mobile
Up arrow icon