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 best solutions below

0
On BEST ANSWER

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

1
On

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