jonnyy

jonnyy

  • NA
  • 2
  • 0

Sorting a DataGrid with a Button Column

Feb 4 2005 3:11 PM
On an ASP.NET page, I've created a DataGrid that is based on a DataView and added a button column to the datagrid so users can click for more details on a certain row. I have also enabled header sorting and that is all working fine. I've created a link that allows the user to sort by multiple rows as well (it simply passes a querystring of what fields to sort by). This is where the problem lies. //I set a variable with the sorting information: m_sortData = "Column1 ASC, Column2 DESC"; //then, I create the DataView using the sort data: dv = new DataView(ds.Tables[0], m_filterData, m_sortData, DataViewRowState.CurrentRows); //then i simply rebind to the DataGrid this.dtgBck.AutoGenerateColumns = false; this.dtgBck.DataSource = dv; this.dtgBck.AllowSorting = true; this.dtgBck.DataBind(); Now all of the columns are sorted, except the button column. It retains the values from the default view and not the newly sorted view. Can anyone figure out what on earth I'm doing wrong? Thanks, j.