473,405 Members | 2,421 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,405 software developers and data experts.

Accessing hidden datagrid field in itemcommand

Hi,

In a datagrid's itemcommand method, I can use
DataGridCommandEventArgs/item/cells/text to bring up a specific field
from a row that was accessed. However, I wish to lookup data from that
row, that is in a hidden field on the datagrid. How can I do this?

I would appreciate a simple answer (if one exists) as you may notice I'm
new to this :p

Cheers,
Chris
Nov 19 '05 #1
2 2645
Chris,

Hidden columns don't render to clients and, naturally, don't come back on
postback. The solution is to hide the column with css rule display:none.
Don't make the column Hidden. Make a css style sheet with a class like this:

..Invisible{display:none}

and specify "Invisible" as CssClass for the column. Something like this:

<asp:BoundColumn DataField="Comment">
<ItemStyle CssClass="Invisible"></ItemStyle><HeaderStyle
CssClass="Invisible"></HeaderStyle>
</asp:BoundColumn>

Then the column will be passed to the browser but still will be hidden.

Eliyahu

"Not Me" <no*****@da.com.hk.org> wrote in message
news:cu**********@ucsnew1.ncl.ac.uk...
Hi,

In a datagrid's itemcommand method, I can use
DataGridCommandEventArgs/item/cells/text to bring up a specific field
from a row that was accessed. However, I wish to lookup data from that
row, that is in a hidden field on the datagrid. How can I do this?

I would appreciate a simple answer (if one exists) as you may notice I'm
new to this :p

Cheers,
Chris

Nov 19 '05 #2
Eliyahu Goldin wrote:
"Not Me" <no*****@da.com.hk.org> wrote in message
news:cu**********@ucsnew1.ncl.ac.uk...
In a datagrid's itemcommand method, I can use
DataGridCommandEventArgs/item/cells/text to bring up a specific field
from a row that was accessed. However, I wish to lookup data from that
row, that is in a hidden field on the datagrid. How can I do this?
Hidden columns don't render to clients and, naturally, don't come back on
postback. The solution is to hide the column with css rule display:none.
Don't make the column Hidden. Make a css style sheet with a class like this:

.Invisible{display:none}
and specify "Invisible" as CssClass for the column. Something like this:

<asp:BoundColumn DataField="Comment">
<ItemStyle CssClass="Invisible"></ItemStyle><HeaderStyle
CssClass="Invisible"></HeaderStyle>
</asp:BoundColumn>

Then the column will be passed to the browser but still will be hidden.


Thanks for that!

Chris
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
0
by: Colin Ramsay | last post by:
Hi all, I don't normally post swathes of code like this but I am truly banging my head off my desk here... I've dynamically created a datagrid within a usercontrol. There are two columns...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
2
by: Syed Sami R. Shah | last post by:
hi all, i am having problem with using itemcommand of datagrid by way of asp:image button. i have put an image button in a datagrid item template and have set CommandName="DeleteRecord" and have...
2
by: Deepesh | last post by:
Good day, I have a specific case of the DataGrid in my solution which is causing the ItemCommand Event Not Firing. So I'm creating a "Skinnable" set of controls. I seperate the actual ASCX file...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
1
by: kevin | last post by:
Hi, I'm working with VS 2005 and Framework 2.0 I have a datagrid with a link and the selectedindexchanged will not fire. The page posts back but does nothing. Protected Sub...
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>...
6
by: =?Utf-8?B?U2FuZHBvaW50R3V5?= | last post by:
In the datagrid I would put key values (that I didnt want to display) in columns marked not visible, in the gridview I would put them in datakeys. Im need to apply greater control over my html, so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.