Hi,
in my wingrid i need to display the value of certain column with images, based on the value of the cell.
I use the InitializeRow events and Row by Row i change the value of Appearance.Image because i have an imageList linked to the wingrid.
The question is : when i have 20000 - 50000 records looping over all of this, i have low-performance. Is there a more efficient solution?
I think about the InitializeRowCollection but can I manage the value row by row ?
If you need help with the WebGrid, I recommend that you post in the WebGrid forum. This forum is for WinGrid.
Hi Mike,
I'm having the same scenario of adding a picture to the column of the webgrid. Can you point me to the right direction of an example please? Being new to this kind of technology, it's difficult for me to figure out what you've meant about the appearance... I need an example to work from and I have been hunting around for a while now, but all the examples I found so far does not have picture or they use a static picture.
thanks and best regards
Mike Saltzman"] What exactly do you mean when you say you are looping through the rows? If you are using the InitializeRow event, you should not have to do any loops, the event fires for each row.
What exactly do you mean when you say you are looping through the rows? If you are using the InitializeRow event, you should not have to do any loops, the event fires for each row.
Yes, but the behavior of this event is row-by-row. The handle of this event consider each row separately.
Mike Saltzman"] How many images do you have?
How many images do you have?
I have 6-7 images and 6-7 text related. The Appearences Objects shold be the best way!
How many images do you have? My guess is that you might be doing this inefficiently by setting the row.Cells[x].Appearance.Image on the cell directly. This means you are creating a new appearance object for every cell. It's much more efficient to create a set of Appearances (in the grid.DisplayLayout.Appearances) collection - one for each image, and then apply the entire appearance to the cell. This limits the number of appearance objects you create.
If that still doesn't help, you might want to consider using a DrawFilter instead of the InitializeRow event. In this approach, what you do is assign a single image to the entire column - probably just a blank image to create a space. Then youuse the DrawFilter to override the drawing of the ImageUIElement inside the cell. This way you only draw the images for cells that are actually on the screen, so it's much more efficient.