Solved

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

Posted on 2009-05-04
5
1,196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

623 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