Solved

asp.net vb.net gridview hide column, passing value hidden

Posted on 2009-05-04
5
1,194 Views
Last Modified: 2012-05-06
I have a gridview with binded with a datatable. I have 4 fields in grid. Id, name, price and a button column. I need to know the value of the id when i press the button. If show the id column all works well. But i need hide the id column, and when hide this column an error occurs. How can pass a value in a hidden column in a gridview.
0
Comment
Question by:rflorencio
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:nmarun
ID: 24297946
0
 
LVL 4

Assisted Solution

by:ki_ki
ki_ki earned 100 total points
ID: 24298744
you can use css file to hide the column too.
0
 
LVL 6

Accepted Solution

by:
M3mph15 earned 400 total points
ID: 24302304
Hi,

You can hide the Column by using a CssClass:

.HiddenColumn 'in style section of <head>
{
         display:none;
}


<Columns>
<asp:BoundField DataField="Action_Key"  HeaderText="Key" InsertVisible="False" >
               <HeaderStyle CssClass="HiddenColumn" />
               <ItemStyle CssClass="HiddenColumn" />
</asp:BoundFiled>
</Columns>

Just change the Asp:BoundField to whatever suits your needs....the important bit is the HeaderStyle and ItemStyle.

Then in you can access the value from code behind with no problem.

HTH
-M3mph15
0
 
LVL 4

Expert Comment

by:ki_ki
ID: 24309760
if you have the footer's show property set to true, you'll have to 'style' it as well.
Am I right M3mph15 ?
0
 
LVL 6

Expert Comment

by:M3mph15
ID: 24310441
Ah yes you can use the same method to hide the footer aswell
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question