The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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.
RCRajadurai C Syncfusion Team 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"; ------ }