GridView Question

  • Thread starter Thread starter Gunawan
  • Start date Start date
G

Gunawan

Dear All,
I have data which display on the GridView.
GridView contain 3 Column (ProductId, ProductCode and Description).
I would like to display only Product Code and Description so I hide
ProductId Column.
Is there any command so I can take value of first column which is Product
ID?
In other words, how can I get value from hidden column on Grid View?

TIA,
Gun
 
The value should still be there and available like the shown values.
Walk through it with the debugger and place breakpoint in the Load
event. Then add your GridView reference to the Watch. You can expand
it out to see exactly where you can find your value.

Placing an ID as a hidden column on a GridView is common practice and
it was done with the DataGrid in ASP.NET 1.1. It is the only real way
to know what data that row was bound to originally.

Brennan
 
Actually I am using SelectedRow Object
GridViewRow row = gv1.SelectedRow;

But I can not get value from column #1 which I hide

Or I should use something else?

FYI I use gv1.DataSource = ds
ds is a dataset object, instead I bound it with SQL Data Source

TIA,
Gun
 
One thing I've used in this case, was to duplicate the label (or whatever
control), along with its databindings inside one of the visible controls, as
a template -
then, make that control invisible - - the column is visible, but the control
is not - but it's still available to get the value

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
 
Back
Top