Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-05-04
5
Medium Priority
?
1,207 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 400 total points
ID: 24298744
you can use css file to hide the column too.
0
 
LVL 6

Accepted Solution

by:
M3mph15 earned 1600 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

783 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