Image index problem in Grid List control

Hi
I have grid list control with imagelist set. I'm filling the list with object datasource. i found that image column takes the index of the property called ImageIndex in object datasource. But i want that each row takes the image based on value of some other property.How will i do this?

Please find the attached sample application.
I have two grid list control in this application-glcSource and GLCOutput. i'm filling both these grid with same list object.

In case of glcSource i want the image for each row should be based on ImageIndex property in the clsData class which i have declared. And in case of GLCOutput i want the image for each row based on the value of 'Status' property in clsData class.

Please help me out with this problem.

Thanks
ak



GridListTest_imageIndex.zip

1 Reply

AD Administrator Syncfusion Team November 30, 2007 01:43 PM UTC

One way you can do this is to subscribe to the QueryCellInfo event on the embedded GridControl and swap the values there.


//subscribe to the event in btnFilldata_Click
GLCOutput.Grid.QueryCellInfo += new GridQueryCellInfoEventHandler(Grid_QueryCellInfo);

//the event code
void Grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.ColIndex == 1 && e.RowIndex > 0)
{
e.Style.ImageIndex = lstData[e.RowIndex - 1].Status;
}
}



Loader.
Up arrow icon