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
425
Data binding
posted

Hi, could somebody please check my code and show me what is wrong?

DataBinding.zip
Parents
No Data
Reply
  • 20255
    Offline posted

    Hello,

    Thank you for contacting us and for the provided sample.

    In the future could I ask you to be more specific with your question, this will help us to save time and efforts to find and investigate  the issue. This will be highly appreciated.

    Now about it, I have noticed that you are using the Columns collection without referring it from GridView. My suggestion is to add GridView and now on rebind the ViewState error will not be thrown.

    You can find the modified sample attached to my reply.

    Code snippet:

    this.WebHierarchicalDataGrid1.GridView.Columns.Add(col2);
    
    .....
    this.WebHierarchicalDataGrid1.GridView.Columns.Clear();
    
    ....
    this.WebHierarchicalDataGrid1.DataKeyFields = this.WebHierarchicalDataGrid1.GridView.Columns["UniqueID"].Key;
    ...
    
    

    WebForm7.zip
Children