Solved

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

Posted on 2009-04-14
3
504 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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