473,776 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview not returning data in event

I have a gridview that some boundfield and buttonfield controls. I have a
data element I
1. want to use when the button is clicked for a given row, but
2. dont want it visibly displayed in the gridview
so I created a boundfield with visible=false as the first column (something
I did in the datagrid).
In my RowCommand event I do some processing using the online docs as a
template. The problem is that when I reference the boundfield as
visible=false, no data comes back. If I set it to visible=true, data does
come back. The problem is that I dont want it to show up in the grid, but I
want access to the data.
Is this possible using the boundfield, but is there another alternative in
the gridview?
Thanks, Mark
May 6 '06 #1
5 1768
If the data is a primary key then use the DataKeys of the GridView otherwise
use cssClass to specify a descriptor where the .display='none' ;
http://msdn2.microsoft.com/en-us/lib...es(VS.80).aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"MarkAurit" wrote:
I have a gridview that some boundfield and buttonfield controls. I have a
data element I
1. want to use when the button is clicked for a given row, but
2. dont want it visibly displayed in the gridview
so I created a boundfield with visible=false as the first column (something
I did in the datagrid).
In my RowCommand event I do some processing using the online docs as a
template. The problem is that when I reference the boundfield as
visible=false, no data comes back. If I set it to visible=true, data does
come back. The problem is that I dont want it to show up in the grid, but I
want access to the data.
Is this possible using the boundfield, but is there another alternative in
the gridview?
Thanks, Mark

May 7 '06 #2
MarkAurit <Ma*******@disc ussions.microso ft.com>'s wild
thoughts were released on Sat, 6 May 2006 09:11:01 -0700
bearing the following fruit:
I have a gridview that some boundfield and buttonfield controls. I have a
data element I
1. want to use when the button is clicked for a given row, but
2. dont want it visibly displayed in the gridview
so I created a boundfield with visible=false as the first column (something
I did in the datagrid).
In my RowCommand event I do some processing using the online docs as a
template. The problem is that when I reference the boundfield as
visible=fals e, no data comes back. If I set it to visible=true, data does
come back. The problem is that I dont want it to show up in the grid, but I
want access to the data.
Is this possible using the boundfield, but is there another alternative in
the gridview?
Thanks, Mark


sound's like the same question I just answered, so I'll
repost my answer here:

Ok, I'm working from memory here so my facts might be a
little off.

Anyhoo - select your datagrid and press f4, find the
property 'DataKeyNames'

Lets say you want to retrieve CustomerID from the database
but don't want to display it in the grid.

Add 'CustomerID' (without quotes) to the DataKeyNames
collection, repeat this for your other fields.

You can retrieve the data with code something like this

GridView1.DataK eys(RowIndex).I tem("CustomerID ")

Jan Hyde (VB MVP)

--
A gossip is a person who has a good sense of rumor (Leopold Fechtner)

May 8 '06 #3
Thank you Phillip. Am I correct that this lets you save only 1 column's
value? In my situation the pk is made up of >1 column, so I concatenated
them and made that the DataKey.

"Phillip Williams" wrote:
If the data is a primary key then use the DataKeys of the GridView otherwise
use cssClass to specify a descriptor where the .display='none' ;
http://msdn2.microsoft.com/en-us/lib...es(VS.80).aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"MarkAurit" wrote:
I have a gridview that some boundfield and buttonfield controls. I have a
data element I
1. want to use when the button is clicked for a given row, but
2. dont want it visibly displayed in the gridview
so I created a boundfield with visible=false as the first column (something
I did in the datagrid).
In my RowCommand event I do some processing using the online docs as a
template. The problem is that when I reference the boundfield as
visible=false, no data comes back. If I set it to visible=true, data does
come back. The problem is that I dont want it to show up in the grid, but I
want access to the data.
Is this possible using the boundfield, but is there another alternative in
the gridview?
Thanks, Mark

May 8 '06 #4
MarkAurit <Ma*******@disc ussions.microso ft.com>'s wild
thoughts were released on Mon, 8 May 2006 08:20:02 -0700
bearing the following fruit:
Thank you Phillip. Am I correct that this lets you save only 1 column's
value?
No.

J
In my situation the pk is made up of >1 column, so I concatenated
them and made that the DataKey.

"Phillip Williams" wrote:
If the data is a primary key then use the DataKeys of the GridView otherwise
use cssClass to specify a descriptor where the .display='none' ;
http://msdn2.microsoft.com/en-us/lib...es(VS.80).aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"MarkAurit" wrote:
> I have a gridview that some boundfield and buttonfield controls. I have a
> data element I
> 1. want to use when the button is clicked for a given row, but
> 2. dont want it visibly displayed in the gridview
> so I created a boundfield with visible=false as the first column (something
> I did in the datagrid).
> In my RowCommand event I do some processing using the online docs as a
> template. The problem is that when I reference the boundfield as
> visible=false, no data comes back. If I set it to visible=true, data does
> come back. The problem is that I dont want it to show up in the grid, but I
> want access to the data.
> Is this possible using the boundfield, but is there another alternative in
> the gridview?
> Thanks, Mark

Jan Hyde (VB MVP)

--
Ejaculate: One more time and you're fired! (J. A. Mc.)

May 8 '06 #5
Hi Mark,

This property takes a comma-separated list of field names and then you would
refer to each key by its index, e.g. GridView1.Selec tedDataKey.Valu es[0] and
GridView1.Selec tedDataKey.Valu es[1] and so on.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"MarkAurit" wrote:
Thank you Phillip. Am I correct that this lets you save only 1 column's
value? In my situation the pk is made up of >1 column, so I concatenated
them and made that the DataKey.

"Phillip Williams" wrote:
If the data is a primary key then use the DataKeys of the GridView otherwise
use cssClass to specify a descriptor where the .display='none' ;
http://msdn2.microsoft.com/en-us/lib...es(VS.80).aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"MarkAurit" wrote:
I have a gridview that some boundfield and buttonfield controls. I have a
data element I
1. want to use when the button is clicked for a given row, but
2. dont want it visibly displayed in the gridview
so I created a boundfield with visible=false as the first column (something
I did in the datagrid).
In my RowCommand event I do some processing using the online docs as a
template. The problem is that when I reference the boundfield as
visible=false, no data comes back. If I set it to visible=true, data does
come back. The problem is that I dont want it to show up in the grid, but I
want access to the data.
Is this possible using the boundfield, but is there another alternative in
the gridview?
Thanks, Mark

May 8 '06 #6

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

Similar topics

4
2617
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....
2
16346
by: | last post by:
Hello, I have a GridView in my ASP.NET 2.0 application that performs the paging feature perfect when I have it bound to a data source. But now I have it bound to a dataset and the paging feature will not work. When I try to use paging I get this error: The GridView 'gvResults' fired event PageIndexChanging which wasn't handled.
5
4839
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
1
9388
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data in the dataset is empty. The cells that are empty, in the gridview control, I would like to have the value of 0 (zero) inserted. Is there a default cell value property or something similar for the asp.net gridview control. So if no data is...
5
6454
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the dataset with a join query for the GetData() select method. I use ObjectDataStore to couple the GridView with the table adapter on the dataset. If I point the ODS at the child table, the GridView will bind to the "normal" select and I end up...
8
18090
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to display data in a "GridView" which is tied to an "ObjectDataSource". In turn, this ObjectDatasource gets it's data from a strongly-typed business object within my code.
0
4666
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box and also get the datakey (in my case personid) of the the rows selected. Please point me in the right direction. This is what i have so far but i have problem accessing the child gridview in the button click event Cheers, Shilpa. <asp:GridView...
6
1986
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview control and in the gridview_RowDataBound event I have string DiscDescrip = Convert.ToString((e.Row.Cells.FindControl("txbxDiscgv") as TextBox ).Text); This returns what was initially loaded in the textbox but not what I had just changed it...
4
11011
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like to iterate thru the gridview's rows, examine the databound controls, then perform a database action. for some reason, i can't find the controls. i have a two templates: one that uses a label the other uses a textbox to display data. when the...
0
10289
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...
0
10120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
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,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8952
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
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...
1
4031
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
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
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.