Hi Han,
Thanks for using Syncfusion product.
Suggestion 1:
By default, GridControl does not have the direct support for RatingControl CellType for grid cells. In order to load the Rating control for grid cells, you can use the Control CellType for grid cells and load RatingControl for every cell. Please refer to the below code example and the sample,
Code example
|
RatingControl rating = new RatingControl();
this.gridControl1.ColStyles[7].CellType = GridCellTypeName.Control;
for (int i = 1; i <= this.gridControl1.RowCount; i++)
{
rating = new RatingControl();
this.gridControl1[i, 7].Control = rating;
rating.Value = Convert.ToInt16(this.gridControl1[i, 7].CellValue.ToString());
} |
Suggestion2:
Also, you can use the QueryCellStyleInfo event to load the values for RatingControl based on the cell value. Please refer to the below code example,
Code example
|
this.gridControl1.QueryCellInfo += GridControl1_QueryCellInfo;
private void GridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.ColIndex == 7 && e.RowIndex > 0 && e.Style.CellType == "Control")
{
if(e.Style.Control is RatingControl)
(e.Style.Control as RatingControl).Value = Convert.ToInt16(e.Style.CellValue.ToString());
}
} |
Please let us know if you have any concerns.
Regards,
Mohanraj G