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
close icon

StyleInfo and PrepareViewStyleInfo

As I understand from http://www.syncfusion.com/Support/article.aspx?id=561 there is no storage allocated for the RowStyles. This causes to do any style configuration and presentation logic in the "PrepareViewStyleInfo" event. For example: I need to change the back color for some rows in a grid. Detecting the rows to select and changing the color are coded in the "PrepareViewStyleInfo". In addition, some columns should contain images. The image logic, which image to which cell should also be in the "PrepareViewStyleInfo" event. Writing lots of presentation logic in this event can cause a slow scroll performance! But I don''t see any other way. Is there a way to do all this logic out of the "PrepareViewStyleInfo" event? If not, how you suggest to handle the performance problam which is raised by this? Thanks, Gil K

1 Reply

AD Administrator Syncfusion Team December 7, 2004 12:14 PM UTC

Not if you are using a GridDataBoundGrid. If you use a GridControl, then rowstyles are available. In PrepareViewStyleInfo, try having minimal code that essentially only does minimal lookups and not a whole tour de force of conditional logic. So, in whatever the trigger mechanisn you are using to decide to color certain rows (or set other properties), you can prepare a ArrayList or Hashtable of objects that hold the state information you need. Then in PrepareViewStyleInfo, you retrieve this state information and use it. You do not have to decide what state information should be used at that point. This is how you would want to handle any state information that is time consuming to generate. But if it is something like coloring alternating rows, this would probably be simpler just to compute the state on the fly, instead of trying to cache it, and retrieve it.

Loader.
Live Chat Icon For mobile
Up arrow icon