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
55
View state error with WHDG
posted

Greetings,

I am developing a WHDG on a visual webpart on sharepoint 2010.  The datasource is set from a dataset at runtime.  I have created a child band and made a templatefield containing a  linkbutton  within the child band (At design time).  Everything works perfect, but when I expand the the rows, i am getting viewstate error.  This is due to the tempatefield in the child records are not rendered initially, but they will be rendered on demand. 

Hence I made to expand any one record at the page load so that one child record is rendered with this templated field (This is not the behavior what I wanted, but to check the issue). 

'To expand one row initially

 If Not Page.IsPostBack Then
            Dim rcount As Integer = Me.WebHierarchicalDataGrid1.GridView.Rows.Count
            For i As Integer = 0 To rcount - 1
                If Me.WebHierarchicalDataGrid1.GridView.Rows(i).IsEmptyParent = True Then
                    Me.WebHierarchicalDataGrid1.GridView.Rows(i).Expanded = True
                    Me.WebHierarchicalDataGrid1.GridView.Rows(i).ExpandChildren()
                    Exit For
                End If
            Next
        End If

Now there is no view state error and i can expand any row without problem.  But how can I work if i don't pre-expand one row at the page load?  Anyone can help me on this issue?

 

Thanks,

Rajesh

Parents
No Data
Reply Children
No Data