I have a webGrid on page and I am filling it out as follows:
A webservice is called in the contructor.
When the webservice returns i create the columns for the grid, then bind it to an object. I then attempt to go row by row and add things to different cells. I try to access a cells content but it is null.
Is there an event that i can use to wait once all cells contents are created?
row.Cells[i].Control is null.
This used to work, but before i had a second webservice called inbetween the creation of the grid and the filling of the cells.
Either way since I am creating the columns and the rows in same call that i am manipulating the cells it doesn't work.
I tried doing it in the loaded function of both my user control and the webGrid itself and neither work.
Is there an event I can use that makes sure all the controls have been attached?
The CellControl is only attached to a Cell that is Visible on the screen. So rows that are off the screen would have Cells[i].Control == null.
Grid has a CellControlAttached event which is raised when a CellControl is attached to a cell.
Its generally not a good practice to call a web service from the page constructor. Can you call it in OnNavigatedTo (if this is a Page) or Loaded (if this is a User Control)?
This makes sure that all of the controls are loaded and ready for the kind of maniplation your trying to do.Devin