Solved

How to Read the value of a Gridview Cell that is not Visible

Posted on 2009-04-14
3
498 Views
Last Modified: 2012-05-06
The visible property of a gridview cell is set to false.

Cells[3] definition:

<asp:BoundField DataField="ToDate" HeaderText="ToDate"
                    ReadOnly="True"
                    Visible="False" />

grdWatchList.SelectedRow.Cells[3].Text  Returns ""

What is the syntax for returning the value of the not visible cell?

Thanks,
0
Comment
Question by:Dovberman
[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
3 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24137839
You can use the same syntax you would for a visible control, provided the control has a value. A control with Visible=False will not be rendered to the browser, but on the server you can access all properties. If you are getting nothing, then the cause must lie somewhere else.
0
 
LVL 14

Accepted Solution

by:
GiftsonDJohn earned 250 total points
ID: 24138098
Hi,

If you put <asp:BoundColumn Visible=false /> the contents won't be stored in the viewstate. If it is not there in viewstate then you won't be able to get in server events of the GridView.

This behavior is not there in DataGrid but is there in GridView. So in order to view the values of the cell in GridView events, don't say Visible=false, instead set the display style to none in the RowDataBound event.

e.Row.Cells[1].Style["display"]="none";
0
 

Author Closing Comment

by:Dovberman
ID: 31569880
Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

Title # Comments Views Activity
Calculating percentage 2 47
Build a string of emails from a gridview 2 30
CSS for Popup in ASP.NET 4 46
Validation for Passport expiry in asp.net 2 31
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

739 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