This is too early in the page processing life cycle to change the cell
text. You'll have to change it in the Page.PreRender or later in the
page life cycle.
If you change the cell text, or pretty much any object in the datagrid,
at this point it is still "vulnerable" to changes being made to it by
the asp.net framework during round trip processing.
Curtis
John Smith wrote:
I'm looking into this peace of code:
protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList list = (DropDownList)sender;
TableCell cell = list.Parent as TableCell;
DataGridItem item = cell.Parent as DataGridItem;
int index = item.ItemIndex;
string content = item.Cells[0].Text;
Response.Write(
String.Format("Row {0} contains {1}", index, content)
);
}
can I do this:
item.Cells[0].Text = "Some text...";
I don't want only to change value in the grid (displayed value), but also in
the underlaying DataSource (which is of XML file type).