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
60
Row data lost on postback
posted

Greetings. I'm totally perplexed at this point.

I have a webgrid that I load rows manually via creating  rows and adding them at runtime, I have no bound columns, I just load some custom values i need to manipulate via code then append to the rows collection such as

Dim uwgCell As New UltraGridCell

uwgCell.Text = CLng(SqlDR("SectionId"))uwgCell.Value = CLng(SqlDR("SectionId"))

uwgRow.Cells.Add(uwgCell)

then

UltraWebGridSectionsQuizzes.Rows.Add(uwgRow)

I do this for about 50 rows.

This is done on the form load event inside the if not Ispostback statement.

The problem is when a postback occurs the row data disappears. It's not persistant. I also group on a column which still shows correctly with the group header but the child rows show but with no data. Need help badly before I pull my hair out.

 Thank you much.

 

 

Parents
  • 60
    posted

    It seem it is necessary to specifically declare that your row be tracked in the ViewState.

    so, uwgCell As New UltraGridCell

    should read uwgCell As New UltraGridCell(True)  sets the row to be stored in ViewState. Haven't tried it yet but I hope this will do it.

    I thought this should be the default but anyways happy coding.

     

Reply Children
No Data