Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 28th, 2008, 11:18 PM
Friend of Wrox
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default How to code to set 'Visible' a field value

There is a 'Visible' behavior for 'Edit Fields' of a GridView, DataView, etc. We can select 'true' or 'false'.
If I set Visible 'False', then I want to set it to 'true,' when one field meets a criterion, e.g. if AppStatus='x'.

How do I add these codes into my VS 2005 aspx page? From 'Edit Fields' of the Design tab or
Soadd codes on the source tab? Where can I see some sample code?

C. Jeffrey Wang
Old February 28th, 2008, 11:51 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

It depends. If you are setting the Edit column visible based upon a value that is databound to your Grid then I would suggest using the RowDataBound event.

If, however, it is based upon a session value for instance you could simply write something like this in your page load:

  if(somevalue == "x"){gv.Columns[0].Visible = true;}
  else{gv.Columns[0].Visible = true;}

You would change Columns[0] to the actual column your Edit Field is in. hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
set Apache Tomcat 5.0 webserver visible in network briss Apache Tomcat 4 July 12th, 2006 08:13 AM
How Do I Set Value For File Field surendran Javascript 1 April 4th, 2006 12:47 AM
Setting visible property on a report field tnzabo Access 3 July 21st, 2005 11:30 AM
set rpttext box visible false myth12345 VB How-To 0 March 4th, 2005 11:08 AM
code visible on website Adamp Beginning PHP 3 September 25th, 2004 11:02 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.