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. Image for the cookie policy date

Icons in grid cells

Hai, We are using a DataBoundGrid to display data. The grid has a Sevirity field which can have values 1,2,3. I am trying for a way to display Icons each representing this Sevirity value instead of 1,2 and 3 or strings like "High", "Medium" and "Low". Is there any way by which I can keep the column values as 1,2 and 3 and display Icons instead of these values getting displayed. Thanks in advance, Bidin

1 Reply

AD Administrator Syncfusion Team August 10, 2004 07:28 PM UTC

Try this. 1) Create an ImageList that holds your icons and set the ImageList as the style.ImageList property for the column. this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.ImageList = imageList; 2) Then handle PrepareViewStyleInfo, and there move the style.CellValue to the styleImageIndex property and set teh style.Text to "".
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(e.ColIndex == 2 && e.RowIndex > 0)
		e.Style.ImageIndex = (int)e.Style.CellValue;
		e.Style.Text = "";

Live Chat Icon For mobile
Up arrow icon