473,396 Members | 1,970 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,396 software developers and data experts.

reading hidden data from a gridview control

Hi I am trying to read hidden data from a gridview control. This works if
the data is visible but if the column is not visible it does not return
anything, thanks.
Int32 itemp = Convert.ToInt32(e.Row.Cells[6].Text);
--
Paul G
Software engineer.
Jun 30 '08 #1
3 2548
If you hide the column with Visible=true, it won't be rendered and won't be
in the Cells collection. Add the column to the DataKeyNames, then you can
get it the DataKeys array.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Paul" <Pa**@discussions.microsoft.comwrote in message
news:5A**********************************@microsof t.com...
Hi I am trying to read hidden data from a gridview control. This works if
the data is visible but if the column is not visible it does not return
anything, thanks.
Int32 itemp = Convert.ToInt32(e.Row.Cells[6].Text);
--
Paul G
Software engineer.

Jun 30 '08 #2
"Paul" <Pa**@discussions.microsoft.comwrote in message
news:5A**********************************@microsof t.com...
Hi I am trying to read hidden data from a gridview control. This works if
the data is visible but if the column is not visible it does not return
anything, thanks.
Int32 itemp = Convert.ToInt32(e.Row.Cells[6].Text);
When you set a webcontrol's Visible property to false, it does not even get
rendered to the client browser.

Therefore, you will need to use CSS to hide it client-side.

Lots of examples of this are available:
http://www.google.co.uk/search?sourc...n+hide+display
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #3
Hi, thanks for the responses. I ended up converting the bound column to a
template column with a lable (lblDiscID) then used Int32 itemp
=Convert.ToInt32 ( (e.Row.Cells[6].FindControl("lblDiscID") as Label).Text);
which seemed to work. Guess there are a few ways to do it.
--
Paul G
Software engineer.
"Mark Rae [MVP]" wrote:
"Paul" <Pa**@discussions.microsoft.comwrote in message
news:5A**********************************@microsof t.com...
Hi I am trying to read hidden data from a gridview control. This works if
the data is visible but if the column is not visible it does not return
anything, thanks.
Int32 itemp = Convert.ToInt32(e.Row.Cells[6].Text);

When you set a webcontrol's Visible property to false, it does not even get
rendered to the client browser.

Therefore, you will need to use CSS to hide it client-side.

Lots of examples of this are available:
http://www.google.co.uk/search?sourc...n+hide+display
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #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...
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...
2
by: Mark Rae | last post by:
Hi, See the following: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic38190.aspx This was a particularly useful feature of the old DataGrid control which seems to...
5
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...
8
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...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
3
by: =?Utf-8?B?U21pdGE=?= | last post by:
Hello all, I have a gridview, and a label inside the <Columnsand ItemTemplate. The label is a hidden. I want to retrieve the value of this label on the gridview_OnPageIndexChanged event, but i...
8
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have a GridView and a hidden field : <asp:TemplateField Visible=false > <ItemTemplate > <asp:HiddenField Value="<%#Eval("isActive")%>" id="hidIsActive" runat=server /> </ItemTemplate>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.