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.

changing celltype dynamically

Thread ID:

Created:

Updated:

Platform:

Replies:

52186 Nov 23,2006 04:41 AM Nov 27,2006 09:52 AM Windows Forms 13
loading
Tags: GridControl
vijayaraghavan
Asked On November 23, 2006 04:41 AM

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.

Administrator [Syncfusion]
Replied On November 23, 2006 05:25 AM

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

vijayaraghavan
Replied On November 24, 2006 01:30 AM

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

Administrator [Syncfusion]
Replied On November 24, 2006 03:48 AM

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

Administrator [Syncfusion]
Replied On November 24, 2006 06:31 AM

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.

Administrator [Syncfusion]
Replied On November 25, 2006 12:15 AM

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

Administrator [Syncfusion]
Replied On November 26, 2006 11:32 PM

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

vijayaraghavan
Replied On November 27, 2006 12:28 AM

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


Administrator [Syncfusion]
Replied On November 27, 2006 02:21 AM

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

Administrator [Syncfusion]
Replied On November 27, 2006 03:50 AM

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

Administrator [Syncfusion]
Replied On November 27, 2006 04:05 AM

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

vijayaraghavan
Replied On November 27, 2006 05:16 AM

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

Administrator [Syncfusion]
Replied On November 27, 2006 06:54 AM

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

vijayaraghavan
Replied On November 27, 2006 09:52 AM

Hi Haneef

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

Thanks Again
Vijayaraghavan

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.

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.

;