Articles in this section
Category / Section

What is the difference between PrepareViewStyleInfo and Model.QueryCellInfo in a GridDataBoundGrid?

1 min read


  • PrepareViewStyleInfo is generally used to modify style properties immediately before the style is used to draw the cell. So, if you have a property setting that is transient in that it dynamcailly changes and is only needed for drawing (like the backcolor depending upon the cellvalue), then PrepareViewStyleInfo is the place to do this work.
  • QueryCellInfo is hit anytime the grid needs a cell style for any reason. So QueryCellInfo is hit prior to PrepareViewStyleInfo, and may be hit for other reasons than preparing the style for drawing. If you use code like grid[row, col], then QueryCellInfo is hit, but PrepareViewStyleInfo may not hit. So, if you are setting a style property that may be of use to you for something other than be drawn a certain way, then you should use QueryCellInfo to set the property dynamically.
Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment