473,396 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is there a way to make an ASP.Net control invisible other than the "visible" property?

I have some controls that I want to be invisible, but if the user does
something, they will become visible using javascript. So I can't set
its "visible" property to false, because then they won't even be
rendered in the page at all. I can set them to invisible using
javascript, but I don't want to do that because then their visibility
isn't saved in the viewstate. Is there any way to make them invisible
from the code-behind file in a way that will be saved in the viewstate
and so that the controls can be accessed through client-side script?

thanks in advance
Nov 18 '05 #1
2 1948
You can attach the style attribute and set it to invisible. That way, it is rendered on the client and you can change the property to visible in javascript

Tu-Thac
www.ongtech.co

----- john wrote: ----

I have some controls that I want to be invisible, but if the user doe
something, they will become visible using javascript. So I can't se
its "visible" property to false, because then they won't even b
rendered in the page at all. I can set them to invisible usin
javascript, but I don't want to do that because then their visibilit
isn't saved in the viewstate. Is there any way to make them invisibl
from the code-behind file in a way that will be saved in the viewstat
and so that the controls can be accessed through client-side script

thanks in advanc

Nov 18 '05 #2
If your control is named myControl

myControl.Style.Add("visibility","hidden");
-- or --
myControl.Style.Add("display", "none");

depending on whether you want the control to hold it's space. (display none
does not hold space in the page, where as setting the visibility will).

Matt
http://www.3internet.co.uk
"john" <jo********@yahoo.com> wrote in message
news:29**************************@posting.google.c om...
I have some controls that I want to be invisible, but if the user does
something, they will become visible using javascript. So I can't set
its "visible" property to false, because then they won't even be
rendered in the page at all. I can set them to invisible using
javascript, but I don't want to do that because then their visibility
isn't saved in the viewstate. Is there any way to make them invisible
from the code-behind file in a way that will be saved in the viewstate
and so that the controls can be accessed through client-side script?

thanks in advance

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John South | last post by:
Hi I'm new to asp.net and c# and I've got stuck on an apparently simple problem: I'm trying to make a HyperLink dynamically visible/invisible. This is the HTML: <asp:HyperLink...
6
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
5
by: Lucvdv | last post by:
Can anyone explain why this happens with the code at the bottom? It looked like a thread safety issue, but changing the declaration of Label1 to Shared doesn't help. Standard windows form;...
6
by: Marc Robitaille | last post by:
Hello, Hello, I developed a UserControl. It has funny behavior. It is composed of three controls. A texbox, a combobox and a button. There are three properties to indicate the visibility of...
5
by: ken | last post by:
Hi, Why can't I do this in the report activate section of my main report? I have a main report, and a subreport on it. The idea is that if the subreport has a certain value in a control within it,...
1
by: jodyblau | last post by:
I have a form that is in Continuous form. In each record there is a button next to the a date box. When the button is pushed, the calendar control is set to visible (rather than in a seperate pop...
2
by: Douglas Peterson | last post by:
Was able to reproduce this with a simple example (using .NET 1.1): 1) Create a new WindowsApplication project 2) Add a button to the form and set its Visible property to false 3) Double click on...
5
by: Doogie | last post by:
Hi, I am trying to access the visible property of an ASP button inside javascript to no avail. Here's what my button control looks like: <asp:Button id="btnAcceptTrips" name="btnAcceptTrips"...
1
by: Andy B | last post by:
Sorry for the dense and simple question. Do controls that have the visible property set to false take up any realestate on the browser window and appear like they don't even exist? Or are they...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.