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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

binding usercontrol to GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

78337 Dec 9,2008 02:47 PM UTC Dec 12,2008 12:47 PM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 9, 2008 02:47 PM UTC

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 12:47 PM UTC

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.

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

;