Solved

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

Posted on 2009-04-14
3
441 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
3 Comments
 
LVL 39

Expert Comment

by:abel
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now