Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-04-14
3
Medium Priority
?
521 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

610 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