> 1- I have a Datagrid Bounded to custom Collection.. Everytime i add
new item
i can see this item in the Grid but after add new item i found only
the last
one even Datagrid viewstate is Enabled..
I think the problem is in my Collection which have [Serializable]
attribute.. I tried to add my collection to cache and viewstate but
the
problem is still there, How could i save my collections state??
I'm going to guess (since I'm having a hard time understanding the exact
problem) that you're databinding your DataGrid in Page_Load and then you're
adding a new item into your collection in a button click event. The Button
click event happens after Page_Load and that would explain why the grid doesn't
show the newly added item. In your button click event rebuild the datagrid
and it should have the newly added item.
2- When i add my collection to the cache and add new item to the
collection is this apply to the cache or i have to add it back again
to the cache or view state (Is it a refrence or new instance)?? and
what about viewstate is it work in the same way as cache and what is
the diffrnce between cache & session coz as i know use the memory??
You should not have to add data to ViewState manually on behalf if a control.
IOW, for a Label, once you set the Text property and its ViewStateEmnabled=true
it should maintain that data, not you. ViewState is so that a single page
and controls set with particular values maintain those values across postback.
Cache is a different thing. It's a server side property bag for frequently
used shared data (shared cross page and user, typically). They serve different
purposes.
-Brock
DevelopMentor
http://staff.develop.com/ballen