By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,125 Members | 1,562 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,125 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Cor
Hi Mike,

We have in this newsgroup our own specialist for datagrid, but that is for a
windowform.

Your question is not that simple I think that you will fast get an answer
here, but maybe you will get it in the newsgroup
micorosoft.public.dotnet.framework.aspnet.datagrid

I know it is not the best advice because in that newsgroup only 1 on the 3
questions is answered in december till now

But you can try

Cor
Nov 20 '05 #2

P: n/a
Well, if you are not going to see them why bother retreiving them. Simply
dont select the fields on the SQL command, that way you only need to alter
the fields you see and leave the others unchanged.

Regards - OHM

==============================================

Mike wrote:
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


Best Regards - OHMBest Regards - OHM On**********@BTInternet.Com
Nov 20 '05 #3

P: n/a
Not a bad suggestion, but I was hoping to be able to update the
DataTable using the LoadDataRow method. I can do as you say, but I
think it would require quite a bit more code, and once I find a really
strange situation like this one, I usually am not satisfied until I
know exactly what's going on. These things just nag at me - perhaps
you can relate!

Anyway, thanks - if I don't get through this soon I can always use
your advice.

Mike

On Sat, 6 Dec 2003 12:47:49 -0000, "One Handed Man [ OHM ]"
<te***************************@BTOpenworld.com> wrote:
Well, if you are not going to see them why bother retreiving them. Simply
dont select the fields on the SQL command, that way you only need to alter
the fields you see and leave the others unchanged.

Regards - OHM

==============================================

Mike wrote:
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


Best Regards - OHMBest Regards - OHM On**********@BTInternet.Com


Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.