T
Tom Carter
I have created a datagrid that has edit/update/cancel links and whose
header is sortable. I have one glitch which I hope sounds familar to
someone ...
I click the edit butoon and the textboxes are populated with data
from a different record than the record which I selected. This
problem occurs only after I sort the data.
What am I missing???
-- here's the code:
private void masterDataGrid_SortCommand(object source,
System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
//Logic Handles Bi-Directional Sorting using SortHandler Hidden
Label
switch (SortHandler.Text.EndsWith(" ASC"))
{
case true :
SortHandler.Text = e.SortExpression.ToString () + " DESC";
break;
case false:
SortHandler.Text = e.SortExpression.ToString () + " ASC";
break;
}
dv.Sort = SortHandler.Text;
this.masterDataGrid.DataSource = dv;
this.masterDataGrid.DataBind();
}
-- heres the edit routine:
private void masterDataGrid_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
this.masterDataGrid.EditItemIndex = e.Item.ItemIndex;
this.masterDataGrid.DataBind ();
}
header is sortable. I have one glitch which I hope sounds familar to
someone ...
I click the edit butoon and the textboxes are populated with data
from a different record than the record which I selected. This
problem occurs only after I sort the data.
What am I missing???
-- here's the code:
private void masterDataGrid_SortCommand(object source,
System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
//Logic Handles Bi-Directional Sorting using SortHandler Hidden
Label
switch (SortHandler.Text.EndsWith(" ASC"))
{
case true :
SortHandler.Text = e.SortExpression.ToString () + " DESC";
break;
case false:
SortHandler.Text = e.SortExpression.ToString () + " ASC";
break;
}
dv.Sort = SortHandler.Text;
this.masterDataGrid.DataSource = dv;
this.masterDataGrid.DataBind();
}
-- heres the edit routine:
private void masterDataGrid_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
this.masterDataGrid.EditItemIndex = e.Item.ItemIndex;
this.masterDataGrid.DataBind ();
}