Home All Groups Group Topic Archive Search About

Retreive values from invisible cell

Author
23 Jan 2005 5:29 PM
Patrice COTE via .NET 247
Hi !

I'm trying to update a table with an editable DataGrid (Edit, Update, Cancel button). In the Update event of the item, I can retreive every value by using the TableCell object (DataGridCommandEventArgs.Item). The only value I can' retreive is the one that I stored in an invisible cell.

Here's a sample code :

protected void ItemsGrid_Update(object sender, DataGridCommandEventArgs e)
{
      //We have to look for the inner control (TextBox) because we're in
      //edit mode and every cell is filled with a TextBox
      string strNumLigne = e.item.Cells[0].Controls[0].Text;
}

If the Cell is Visible, it works fine, but if it's not, I always get "". Does anybody knows how could I get the value of this invisible cell ?


--------------------------------
From: Patrice COTE

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>G3j2X84aM0qSoT+tO+AQdQ==</Id>

Author
24 Jan 2005 8:31 PM
Jeppe Dige Jespersen
Hmmm.... I dont see why this would be a problem. But....

Perhaps try assigning the textbox controls in your template
columns an ID value in the HTML/aspx file. Then, instead
of retrieving the .text property from the textbox with....
e.item.Cells[0].Controls[0].Text;
......you could retrieve it with:
string strNL = (textbox)(e.item.findcontrol("myTextboxID")).text;

The findcontrol method is more forgiving when inserting more
columns and stuff, so you dont have to keep track of all the
indexes and such.

I tried this approach, and had no problems retrieving from
invisible textbox fields within my template columns.

Good luck,
Jeppe Jespersen








"Patrice COTE via .NET 247" <anonym***@dotnet247.com> skrev i en meddelelse
news:O34kIEXAFHA.2112@TK2MSFTNGP14.phx.gbl...
Hi !

I'm trying to update a table with an editable DataGrid (Edit, Update, Cancel
button). In the Update event of the item, I can retreive every value by
using the TableCell object (DataGridCommandEventArgs.Item). The only value I
can' retreive is the one that I stored in an invisible cell.

Here's a sample code :

protected void ItemsGrid_Update(object sender, DataGridCommandEventArgs e)
{
      //We have to look for the inner control (TextBox) because we're in
      //edit mode and every cell is filled with a TextBox
      string strNumLigne =
}

If the Cell is Visible, it works fine, but if it's not, I always get "".
Does anybody knows how could I get the value of this invisible cell ?


--------------------------------
From: Patrice COTE

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>G3j2X84aM0qSoT+tO+AQdQ==</Id>