Non-displayed values in DataGrid that stay accessible in EditCommand event?

M

Mike

I've got an app with a DataTable that gets passed around and modified
by datagrids on 3 different asp.net pages. Not all columns need to be
displayed, but I need them all in the datagrid so I can call the
LoadDataRow method to update the DataTable "in place".

I've been using boundcolumns for the invisible fields, which worked
fine, but now I've run into an issue with them. On the second of the
3 pages, the user can modify certain values and if a row is modified
in the datagrid I immediately update the DataTable, so I've got some
code in the grid Grid EditCommand event that handles all this.

For some reason the boundcolumns that are set to visible = False all
return empty strings in the EditCommand event, even though they
contain legitimate values. At first I tried getting the values out
using e.item.cells(x).text - that didn't work. I've noticed in
certain other situations that I have to dimension a textbox, assign
the textbox to the cell in question and then read the textbox.text
value into a string var, so I tried that and it didn't work either.

Just to make sure the grid columns were all being populated I set
visible to true temporarily. Sure enough all columns had data *and* I
was able to fetch the values from the boundcolumns using both of the
methods described above.

So I guess my question, put concisely, is what is the best way to
store non-displayed values in a datagrid in a fashion that will allow
them to be easily accessed in the grid's EditCommand event?

TIA,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top