473,595 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3536
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.goog legroups.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**********@g mail.comwrote in message
news:Or******** ******@TK2MSFTN GP06.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.goog legroups.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
5669
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 GridView to allow entry of quantity and Y/N switch for
6
3030
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 current_row_key of Grid1... to the objectDataSource2 parameter? (so that the second grid, gets only the information to do with current row of grid1)
4
2611
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 re-format the updated row fields. I have looked at gridView.rowUpdated method, but cannot figure out how....
7
14793
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 want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
1
3232
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 SQLDataSource. The GridView contains 3 columns: QuestionNumber, QuestionText, and a TemplateField. Each row in the GridView represents a question in a table (Ex.: "18. Satisfaction Level").
4
1807
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 the data on each click fetched from the server, or are they 'cached' on the client-side and so avoiding a lot of transferts between server and browser? If not 'cached', would it not bebetter to use the client callback
3
311
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 (regular gridview, no custom controls inside, bound to a list<custom object>) loose it's value after a postback. I know that the datasource is not saved in viewstate, but why are the rows getting cleared???? Thanks in advace Gonzalo, from...
1
8562
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 it doesn't seem to work at all. Below is my ASP.NET page, and further below, my VB.NET method that I am trying to call: <div id="admin-faq" class="page"> <h2>Site FAQs (Frequently Asked Questions)</h2>
4
11142
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 ReportTable As System.Data.DataTable = New System.Data.DataTable("SendTo") The ReportTable is populated row by row by data gotten back from the
1
1622
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 having trouble getting gv2 to show any data. Here's part of my code...
0
7955
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7883
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8019
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5839
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5418
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2391
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1490
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.