473,320 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

GridView Question

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
Sep 1 '06 #1
3 3495
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

Gunawan wrote:
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
Sep 1 '06 #2
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
<of******@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
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

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

Sep 1 '06 #3
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

"Gunawan" <jg**********@gmail.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
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
<of******@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
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

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


Sep 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
4
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
4
by: Chris | last post by:
Hi, I read about client callback and i have a question. Assume the option "sorting" is set in a gridview. Each time the user clicks on a fieldname, the data are sorted. My question is: are...
3
by: Gonza | last post by:
Hi group, i have a question relatred to gridview and postback (i should probably know this by now, considering i've been working with .net for a few years now, but baahh). Why could a gridview...
1
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
4
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have a vb.net 2.0 app that is loading a GridView with a DataSource that is returned from a function. The definitions in the function are: Dim ReportDS As DataSet = New DataSet Dim...
1
by: Cirene | last post by:
This is confusing... I have a gridview (gv1) with another gridview (gv2) inside of it. gv1 has a bunch of house listings and within each row is a group of related house pictures (gv2). I'm...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.