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

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 1790
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=[myhiddendatavalue,...] 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**************@TK2MSFTNGP04.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
"PeterKellner" <ho****@fetchemail.com> wrote in message
news:7p********************@comcast.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=[myhiddendatavalue,...] 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
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...
7
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...
6
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...
2
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...
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 -...
3
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...
5
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"...
1
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) { ...
4
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...

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.