S
sosh
Hi,
I'm having a strange problem with the update function of a datagrid:
I have a datagrid, the first column lists item names from a database.
Second column is an EditCommandColumn, and then I have a couple of
button columns after that to deal with row deletes etc.
The problem is occuring in the method that I have specified should
deal with the update event:
protected void nameEditUpdate(object sender, DataGridCommandEventArgs
e)
Because the first column I know contains the item that is getting
updated, I try:
tmpTextBox = (TextBox)e.Item.Cells[0].Controls[0];
To get the control, before looking at its Text property. However,
when I try this I get:
System.InvalidCastException: Specified cast is not valid.
So to try and figure out what is going on, I have tried looking at the
type being returned by e.Item.Cells[0].Controls[0], which turns out to
be type System.Web.UI.LiteralControl, the name and text properties of
it are blank. This has just confused me even more.
Anyone have any idea just what might be going on?
Appreciated!
I'm having a strange problem with the update function of a datagrid:
I have a datagrid, the first column lists item names from a database.
Second column is an EditCommandColumn, and then I have a couple of
button columns after that to deal with row deletes etc.
The problem is occuring in the method that I have specified should
deal with the update event:
protected void nameEditUpdate(object sender, DataGridCommandEventArgs
e)
Because the first column I know contains the item that is getting
updated, I try:
tmpTextBox = (TextBox)e.Item.Cells[0].Controls[0];
To get the control, before looking at its Text property. However,
when I try this I get:
System.InvalidCastException: Specified cast is not valid.
So to try and figure out what is going on, I have tried looking at the
type being returned by e.Item.Cells[0].Controls[0], which turns out to
be type System.Web.UI.LiteralControl, the name and text properties of
it are blank. This has just confused me even more.
Anyone have any idea just what might be going on?
Appreciated!