View Single Post
Old July 8th, 2005, 09:33 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

quote:Originally posted by demivolt
 I am thinking that I may be confused about what data is available during a preRender event.

I think the answer to the original question has been provided above, but I wanted to chime in with something.

The important thing to remember with a DataGrid is that the DataSource is only available during a page execution when the DataSource was set. It sounds like in your situation this is when you changed the selection of the DDL that establishes the criteria for the query. During a page execution where the DataSource has been set, you can interrogate this property, otherwise (postback not related to changing grid data) it will be null. Then you can't find out how many rows are in the grid's source data when paging is enabled. This is usually not a problem because you'd put the page count result into a label that is stateful and needn't be changed until you rebind the grid.