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.

binding usercontrol to GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

78337 Dec 9,2008 09:47 AM Dec 12,2008 07:47 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 9, 2008 09:47 AM

Hi,
I am binding a dataset to GridDataBoundGrid control.
One of the columns in the grid includes cells ,and inside each of these cells there is a usercontrol.
These usercontrols also need to be bound to the data.
How can I add usercontrols to the cells
and bind data to them?
Thanks.


Rajadurai C [Syncfusion]
Replied On December 12, 2008 07:47 AM

Hi Shimon,

Thanks for your interest in Syncfusion products.

To add the user control to grid and make use of it. Please follow these steps.
1) Create a model and a renderer class deriving from GridGenericCellModel and GridGenericCellRenderer classes respectively with properties to be made available.

2) Add this control to the cellmodels of griddataboundgrid as,

this.gridDataBoundGrid1.Model.CellModels.Add("MyComboBox", new ComboCellModel(this.gridDataBoundGrid1.Model));

Here, "MyComboBox" denotes the name of the usercontrol and ComboCellModel is the class created deriving from GridGenericCellModel.

3) Add the usercontrol to the respective cell.

How to add usercontrol to the cell
*******************************************
To provide the entire grid have the same usercontrol.

this.gridDataBoundGrid1.TableStyle .CellType = "MyComboBox";
this.gridDataBoundGrid1.TableStyle. CellValue = "One";
.......


To provide usercontrol to the specified cells, handle the PrepareViewStyleInfo event in griddataboundgrid.

if(e.RowIndex ==1 && e.ColIndex == 2)
{
e.Style.CellType = "MyComboBox";
e.Style.CellValue= "One";
------
}


Regards,
Rajadurai


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.

;