473,756 Members | 5,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView controls and hidden columns

Hi,

See the following:
http://www.devnewsgroups.net/group/m...opic38190.aspx

This was a particularly useful feature of the old DataGrid control which
seems to be missing from the new GridView control

What is the "preferred" method of doing this in a GridView?

Any assistance gratefully received.

Mark
May 14 '06 #1
2 1810
The problem is that in asp.net 2.0, Microsoft has decided not to store
hidden columns in viewstate for security reasons. That is, say you put
payroll data in a table and made the column hidden for non-hr people. Us
developer types could look at viewstate and get it.

The workaround is to add to the gridview attribute
datakeynames=[myhiddendataval ue,...] and this will force the hidden column
back into viewstate. There are also issues around encrypting viewstate and
performance you should keep in mind also.

Peter Kellner
http://peterkellner.net
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:Ov******** ******@TK2MSFTN GP04.phx.gbl...
Hi,

See the following:
http://www.devnewsgroups.net/group/m...opic38190.aspx

This was a particularly useful feature of the old DataGrid control which
seems to be missing from the new GridView control

What is the "preferred" method of doing this in a GridView?

Any assistance gratefully received.

Mark

May 14 '06 #2
"PeterKelln er" <ho****@fetchem ail.com> wrote in message
news:7p******** ************@co mcast.com...
The problem is that in asp.net 2.0, Microsoft has decided not to store
hidden columns in viewstate for security reasons. That is, say you put
payroll data in a table and made the column hidden for non-hr people. Us
developer types could look at viewstate and get it.
Seems reasonable.
The workaround is to add to the gridview attribute
datakeynames=[myhiddendataval ue,...] and this will force the hidden column
back into viewstate. There are also issues around encrypting viewstate
and performance you should keep in mind also.


Understood - thanks for the response.
May 14 '06 #3

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

Similar topics

1
9356
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes GridView.Visible = True. I press HIDE and the GridView disappears as expected. After it I press SHOW and the GridView doesn't show.
7
5470
by: WayDownUnder | last post by:
Hello, I have a gridview control bound to a objectdatasource. The primary key column is on the grid but made visible = false. Because the column is invisible I cant get to the cell value when the user presses the edit button on the grid. Code protected void grdBedpDetails_RowEditing(object sender, GridViewEditEventArgs e)
6
3474
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page and not show the templated fields, (hyperlinks) and also not print those fields?
2
2634
by: Richard Carpenter | last post by:
I have a four-page tabcontrol with a gridview on each page. I have the primary key column of each gridview set to hidden (visible = false), but it still shows up on all but the first page. Anyone else see this behavior? How might I correct it?
4
7252
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 - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
3
2264
by: =?Utf-8?B?c2hhcnJpczEyMzQ1?= | last post by:
Hi, I have a GridView that has one column that I fill with an alternating "Title Row" then "Details Row". The Title row has a button that I use to hide it's corresponding details row that is underneath it for users to collapse detail rows leaving the title row visible. The button can be clicked again to show the details. This used to work great using a DataGrid but when I upgraded it to a GridView I experience the following problem:
5
23632
by: NKaufman | last post by:
<asp:GridView ID="Basic" runat="server" DataKeyNames="QuestionID,isHeading" AutoGenerateColumns="false" AllowPaging="true" PageSize="100"> <Columns> <asp:BoundField Visible="false" DataField="QuestionID" HeaderText="QuestionID"></asp:BoundField> <asp:BoundField DataField="QuestionDesc" HeaderText="Question" ItemStyle-HorizontalAlign="Left"></ asp:BoundField>
1
1945
by: neobonzi | last post by:
Hello! I'm dynamically creating a GridView bound to a datatable using custom template columns using the following method: protected void ShowGrid(DataTable dt) { int i; int j; for( i = 0; i < dt.Columns.Count; i++) {
4
11009
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
9456
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
9275
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
10040
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
9873
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...
0
8713
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
7248
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
6534
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();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.