WebDataGrid sorting with a generic list

2.9k views Asked by At

I have a generic collection like this

Dim List(Of t) myData = data.GetData()
myWebDataGrid.DataSource = myData
myWebDataGrid.DataBind()

the config of the webdatagrid sort is this

<Behaviors>
   <ig:Sorting Enabled="true" SortingMode="Multi">
      <ColumnSettings>
          <ig:SortingColumnSetting ColumnKey="Key1" Sortable="true" />
      </ColumnSettings>
   </ig:Sorting>
</Behaviors>

but when I set the sortable property on this control and run the page... I just try to sort and all the data disappears.

2

There are 2 answers

0
jcvegan On BEST ANSWER

I realized that after the postback I have to set the data again.

1
Hristo On

Yes the grid expects to have datasource on every postback. Or you can try to set EnableDataViewState="true"