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

hidden column in gridview

Hai Friends
I n my case i am reterieving some datas from the backend
in that one patricular column in the gridview should be hidden.it should not shown in the screen.in case if is use visible="false" the datas not showing in when clicking the event the text box how to do this pls help me.
source code:
---------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <asp:BoundField DataField="GLAC_NAME" HeaderText="A/cNo">
  2. <ItemStyle Width="200px" />
  3. </asp:BoundField>
this particular column i have to hidden should not shown to the user
code begin:
----------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. protected void GridLedger_RowDataBound(object sender, GridViewRowEventArgs e)
  2. {
  3.   try
  4.   {
  5.     if (e.Row.RowType == DataControlRowType.DataRow)
  6.     {
  7.       e.Row.Attributes.Add("onMouseDown", "var str = document.getElementById('" + e.Row.ClientID + "').cells[1].innerText; document.getElementById('"+TextBox1.ClientID+"').value = str;"); 
  8.  
  9.     }
  10.   }
  11.   catch (System.Exception ex)
  12.   {  
  13.     throw ex;
  14.   }
  15. }
here is the code begin in this what cell value i should mention pls help me
Dec 8 '09 #1
1 2469
Frinavale
9,735 Expert Mod 8TB
Use CSS to hide the column.

When you use .NET code and you set something to Visible=False that control is not rendered. This means that no HTML code is generated for this control.

If you need this to exist client side (so that you can do calculations client side) then you need to hide the element using CSS.

To hide an element you can do one of 2 things with CSS.
You can use "visible:hidden" or "display:none".

If you use visible:hidden then the element is hidden but the space that it takes up will still show up.

If you use display:none then the element is not displayed...therefore there is no gap where the element should be like when you use visible:hidden.

Check out w3c for more information on the visible style and the display style.

I prefer to use display:none because then there is no invisible object taking up room for no reason....but there are some circumstances where this could be useful.

So try:
Expand|Select|Wrap|Line Numbers
  1. <asp:BoundField DataField="GLAC_NAME" HeaderText="A/cNo">
  2.   <ItemStyle CssClass="hideElement"  />
  3.   <HeaderStyle  CssClass="hideElement"  />
  4. </asp:BoundField>
Where you have a CSS class defined as:
Expand|Select|Wrap|Line Numbers
  1. .hideElement{
  2.   display:none;
  3. }
This will hide the header for the column and the column data itself.

-Frinny
Dec 8 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mark Rae | last post by:
Hi, See the following: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic38190.aspx This was a particularly useful feature of the old DataGrid control which seems to...
3
by: Tom | last post by:
I have a gridView with a hidden column, I need to get that value from that hidden column and pass it to another page. is that possible if so how?
2
by: denvercr | last post by:
Hi guys, I'm having a problem on this a couple of days ago.. I did the best I could but I end up nothing. you guys are my last resort.. How could I possibly retrieve a value of a hidden column...
3
by: denvercr | last post by:
Hi how do i possibly get the value of a hidden column (id) of a gridview binded in sqldatasource? i have this code in C# usng GridViewRow and DataKey Classes to retrieve it, I also set the...
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 -...
1
by: MP | last post by:
Hi all, who knows how to use hidden columns from GridView in Update Command from attached to it SqlDataSource? For example: I have hidden column UserId and for given case I want to use it as...
8
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have a GridView and a hidden field : <asp:TemplateField Visible=false > <ItemTemplate > <asp:HiddenField Value="<%#Eval("isActive")%>" id="hidIsActive" runat=server /> </ItemTemplate>...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I am trying to read hidden data from a gridview control. This works if the data is visible but if the column is not visible it does not return anything, thanks. Int32 itemp =...
0
by: Slickuser | last post by:
Is there a way to get values from GridView when it's a hidden Column. This code work if my column is set Visible to true. DropDownList ddl = (DropDownList)sender; GridViewRow row =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.