Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
WebData Grid View State Issue
posted

Hi,

 

I am Using WebDataGrid in my form. I am binding the control in my page load(inside !IsPostBack). I set my DataSource as a List<SomeObject>. After that i Bind the Control. The data is populated in the grid. After that i made a postback in my form. (Click a Button for example).

After this postback the Grid which i bind is getting cleared. Only the header of the grid is maintaining the state. The Details row will be completly Blank.

Can you guid me, if i am missing some thing, or do I need to set any property for the Grid.

 

Please Help me..

 

Thank You..!!!

  • 25
    posted

    Hi, I had this problem too, I had 3 choices:

    1. Set the property EnableDataViewState to true, so the data will be stored in the grid's viewstate.
    2. Set DataSource and call DataBind on every Page_Load event, regardless of the IsPostBack flag.
    3. Link to an ObjectDataSource through the DataSourceID property, so the the data is automatically refreshed on demand.

    In my case, I chose option 2, because I already had to save the data in a  viewstate property. But I think you may have a different scenario.