I'm afraid your original data source is gone after postback. The grid
serializes its data in ViewState by default so you don't necessarily have to
rebind after every postback, so that gives the illusion that your original
data source is still there - but it's not.
If you want your original data source object then you'll have to manually
store it between postbacks or requery your data source after the postback.
--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Doogie" <dn******@dtgnet.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Hi
I have a gridview on my web page and I bind it to an object of my own
creation. When I click a button on that page, I want to get the data
from that gridview and cast it back into that object I created and
start to do work on it. I tried something like this:
List<MyObjectmyObject = (List<MyObject>)myGrid.DataSource;
But I noticed that when I get to this line, "myGrid.DataSource" is
null. Yet, I can access the "myGrid.Rows.Count" value and see the
correct number of rows in my grid.
How can I convert to my own object?