C
Chris Smith
I am changing the EditText in a EditCommandColumn in a DataGrid in an
ItemCreate event handler . The only problem I am having is that instead of
changing the text in the current row it changes the next row.
I watch the value in the debugger, and I see it change at what appears to be
the right time.
The EnableViewState is set to True.
Any suggestions or thoughts appreciated!
I read a value out of the current DataGridItem DataItem (a person's name),
and use it to replace the EditCommandColumn's EditText field.:
private void hhItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
string HouseholdName;
DataGrid dg;
dg = (DataGrid)sender;
EditCommandColumn ecc;
ecc = (EditCommandColumn)dg.Columns[0];
Troop.FunWithXML.TroopDB.HouseholdRow r =
(Troop.FunWithXML.TroopDB.HouseholdRow)e.Item.DataItem;
if(r == null) return;
HouseholdName =
((Troop.FunWithXML.TroopDB.HouseholdRow)e.Item.DataItem)["HHName"].ToString(
);
ecc.EditText = HouseholdName;
}
}
ItemCreate event handler . The only problem I am having is that instead of
changing the text in the current row it changes the next row.
I watch the value in the debugger, and I see it change at what appears to be
the right time.
The EnableViewState is set to True.
Any suggestions or thoughts appreciated!
I read a value out of the current DataGridItem DataItem (a person's name),
and use it to replace the EditCommandColumn's EditText field.:
private void hhItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
string HouseholdName;
DataGrid dg;
dg = (DataGrid)sender;
EditCommandColumn ecc;
ecc = (EditCommandColumn)dg.Columns[0];
Troop.FunWithXML.TroopDB.HouseholdRow r =
(Troop.FunWithXML.TroopDB.HouseholdRow)e.Item.DataItem;
if(r == null) return;
HouseholdName =
((Troop.FunWithXML.TroopDB.HouseholdRow)e.Item.DataItem)["HHName"].ToString(
);
ecc.EditText = HouseholdName;
}
}