Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 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 Professional 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 July 18th, 2007, 11:00 AM
Authorized User
Join Date: Jul 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Button does not retain visible property

I've a asp:button which is set to visible="false" in .aspx.this is on a search page.in code behind if search returns >0 records the button is set to visible=true.
funny thing thats happenin here is first time when the search returns some records & the button is visible, but on next search when records returned is zero, the button is still visible, unless i do an explicit visible=false in code behind.is the button not supposed to take the default proprety that is set in .aspx on postback?
Old July 18th, 2007, 11:16 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

The button stores the Visible property in ViewState, so it survives postbacks.

You either need to set it explicitly, or set EnableViewState on the button to false.



Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Old July 18th, 2007, 11:24 AM
Authorized User
Join Date: Jul 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

cool!!should have thought about it.
thanks Imar

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retain radio button check asif_aslam ASP.NET 1.0 and 1.1 Professional 0 May 4th, 2006 06:10 AM
Word.ApplicationClass Visible Property danielv General .NET 0 January 11th, 2006 12:50 PM
Control button caption and visible property chacquard Access VBA 7 September 9th, 2005 11:14 AM
Visible row property Louisa VB.NET 2002/2003 Basics 0 October 29th, 2004 04:26 AM
Visible property glitch bmains VS.NET 2002/2003 3 May 5th, 2004 02:36 PM

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