![]() |
| | #1 |
| Registered User Join Date: May 2005
Posts: 22
| Sorting and deleting with a DataView in ASP.NET 1.1 So if I have the DataView bound, is there a reason why after it is sorted, if I try to get the primary key (just happens to be column 12) I would get the value of the item that's there with default sorting instead of what I can see? Here's approxamatly what I do in my code: Code: public void LoadData(DataGrid myDataGrid, string sortExpression)
{
sqlDataAdapter.Fill(myDataSet, "table");
myDataSet.Tables["myTable"].DefaultView.Sort = sortExpression /* sortExpression is set in the Sort event, then passed in */
myDataGrid.DataSource = myDataSet.Tables["myTable"].DefaultView;
myDataGrid.DataBind();
}
public void MyGrid_Delete(string primKey)
{
foreach(DataRow currentRow in myDataSet.Tables["myTable"])
{
if (currentRow.Cells[11] == primKey)
{
currentRow.Delete();
break;
}
}
sqlDataAdapter.Update(myDataSet, "myTable");
}
|
| shuuhen is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| deleting structs in an array and sorting the array of structs[ascending].. | Huskar | C Programming | 3 | 03-31-2009 12:34 PM |