Solved

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

Posted on 2009-05-04
5
1,193 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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.…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 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