473,395 Members | 1,368 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,395 software developers and data experts.

Access hidden asp.net objects

How do you hide an asp.net object and still be able to access it?

I had my email in a session variable, but you can't access the session
variable from Javascript (I don't think - since Javascript is Client and
Session is Server).

I tried using the email that was on the page, but it was surrounded by a
Panel that had its visible property set to false - so anything inside of the
Panel was not on the page.

I also tried to set a variable:

<asp:Label ID="emailSave" Visible="false" runat="server"/>

But I had the same problem as the Panel, it wasn't on the page.

I am trying to access this from a page I open so this page is now the
opener.

How can I hide a variable and still get access to it via the Javascript?

Thanks,

Tom
Sep 10 '07 #1
7 2931
Not sure what you mean by "hidding". You can render this value as an hidden
field or by rendering dynamically created JavaScript so that this is usable
client side (in both cases "view source" will reveal the value).

What do you do with this value ? If you don't need this client side, just
retrieve this server side at will rather than passing this value to the
client just to postback the value to the server...

---
Patrice

"tshad" <t@home.coma écrit dans le message de news:
uO**************@TK2MSFTNGP06.phx.gbl...
How do you hide an asp.net object and still be able to access it?

I had my email in a session variable, but you can't access the session
variable from Javascript (I don't think - since Javascript is Client and
Session is Server).

I tried using the email that was on the page, but it was surrounded by a
Panel that had its visible property set to false - so anything inside of
the Panel was not on the page.

I also tried to set a variable:

<asp:Label ID="emailSave" Visible="false" runat="server"/>

But I had the same problem as the Panel, it wasn't on the page.

I am trying to access this from a page I open so this page is now the
opener.

How can I hide a variable and still get access to it via the Javascript?

Thanks,

Tom

Sep 10 '07 #2
Server controls with Visible=false don't get rendered to client. Leave
Visible=true and hide with css rule display:none.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"tshad" <t@home.comwrote in message
news:uO**************@TK2MSFTNGP06.phx.gbl...
How do you hide an asp.net object and still be able to access it?

I had my email in a session variable, but you can't access the session
variable from Javascript (I don't think - since Javascript is Client and
Session is Server).

I tried using the email that was on the page, but it was surrounded by a
Panel that had its visible property set to false - so anything inside of
the Panel was not on the page.

I also tried to set a variable:

<asp:Label ID="emailSave" Visible="false" runat="server"/>

But I had the same problem as the Panel, it wasn't on the page.

I am trying to access this from a page I open so this page is now the
opener.

How can I hide a variable and still get access to it via the Javascript?

Thanks,

Tom

Sep 10 '07 #3
"Patrice" <http://www.chez.com/scribe/wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
Not sure what you mean by "hidding". You can render this value as an
hidden field or by rendering dynamically created JavaScript so that this
is usable client side (in both cases "view source" will reveal the value).

What do you do with this value ? If you don't need this client side, just
retrieve this server side at will rather than passing this value to the
client just to postback the value to the server...
I am trying to do this to get access from Javascript (clientSide) to my
variables on my parent page.

The problem is that if I do something like:

<asp:Panel ID="EmailPanel" visible=false runat="server">
<asp:TextBox ID=Email runat="server"/>
</asp:Panel>

or

<asp:Label ID="EmailSave" Visible=false/>

In either case, the variables do not seem to be on the page so JavaScript
can't see them.

I need this value to put onto the page that I am opening up.

Thanks,

Tom
>
---
Patrice

"tshad" <t@home.coma écrit dans le message de news:
uO**************@TK2MSFTNGP06.phx.gbl...
>How do you hide an asp.net object and still be able to access it?

I had my email in a session variable, but you can't access the session
variable from Javascript (I don't think - since Javascript is Client and
Session is Server).

I tried using the email that was on the page, but it was surrounded by a
Panel that had its visible property set to false - so anything inside of
the Panel was not on the page.

I also tried to set a variable:

<asp:Label ID="emailSave" Visible="false" runat="server"/>

But I had the same problem as the Panel, it wasn't on the page.

I am trying to access this from a page I open so this page is now the
opener.

How can I hide a variable and still get access to it via the Javascript?

Thanks,

Tom


Sep 10 '07 #4
Expected. When you set visible to false server side it is not rendered at
all in the resulting HTML code (unlike using display:none for example).

http://msdn2.microsoft.com/en-us/lib...ddenfield.aspx
allows to easily render an hidden field (and as said earlier, note that view
source is enoguh to show its content).

---
Patrice

"tshad" <t@home.coma écrit dans le message de news:
uL**************@TK2MSFTNGP02.phx.gbl...
"Patrice" <http://www.chez.com/scribe/wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>Not sure what you mean by "hidding". You can render this value as an
hidden field or by rendering dynamically created JavaScript so that this
is usable client side (in both cases "view source" will reveal the
value).

What do you do with this value ? If you don't need this client side, just
retrieve this server side at will rather than passing this value to the
client just to postback the value to the server...

I am trying to do this to get access from Javascript (clientSide) to my
variables on my parent page.

The problem is that if I do something like:

<asp:Panel ID="EmailPanel" visible=false runat="server">
<asp:TextBox ID=Email runat="server"/>
</asp:Panel>

or

<asp:Label ID="EmailSave" Visible=false/>

In either case, the variables do not seem to be on the page so JavaScript
can't see them.

I need this value to put onto the page that I am opening up.

Thanks,

Tom
>>
---
Patrice

"tshad" <t@home.coma écrit dans le message de news:
uO**************@TK2MSFTNGP06.phx.gbl...
>>How do you hide an asp.net object and still be able to access it?

I had my email in a session variable, but you can't access the session
variable from Javascript (I don't think - since Javascript is Client and
Session is Server).

I tried using the email that was on the page, but it was surrounded by a
Panel that had its visible property set to false - so anything inside of
the Panel was not on the page.

I also tried to set a variable:

<asp:Label ID="emailSave" Visible="false" runat="server"/>

But I had the same problem as the Panel, it wasn't on the page.

I am trying to access this from a page I open so this page is now the
opener.

How can I hide a variable and still get access to it via the Javascript?

Thanks,

Tom



Sep 10 '07 #5
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ew**************@TK2MSFTNGP02.phx.gbl...
Server controls with Visible=false don't get rendered to client. Leave
Visible=true and hide with css rule display:none.
That worked great.

If I set the Panel display:none, will it work the same way and hide the
controls but leave them on the page?

Is there a way to set this from vb.net during processing?

I periodically set visible to false to hide a control or section of HTML
with controls on them. This is usually done by <Div id="something"
runat=falseor <asp:Panel id = "something" runat=falseand then setting
something.visible=false.

This works pretty well most of the time.

But sometimes I do need to get access to the variables from Javascript - so
visible=false won't work.

So where I do something like this to hide panel in my asp.net code:

thePanel.visible = false

Is there a better way to do this so I can get access to the variables from
the panel?

How would I set style="display:none" from asp.net?

Thanks,

Tom
>
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"tshad" <t@home.comwrote in message
news:uO**************@TK2MSFTNGP06.phx.gbl...
>How do you hide an asp.net object and still be able to access it?

I had my email in a session variable, but you can't access the session
variable from Javascript (I don't think - since Javascript is Client and
Session is Server).

I tried using the email that was on the page, but it was surrounded by a
Panel that had its visible property set to false - so anything inside of
the Panel was not on the page.

I also tried to set a variable:

<asp:Label ID="emailSave" Visible="false" runat="server"/>

But I had the same problem as the Panel, it wasn't on the page.

I am trying to access this from a page I open so this page is now the
opener.

How can I hide a variable and still get access to it via the Javascript?

Thanks,

Tom


Sep 10 '07 #6
If I set the Panel display:none, will it work the same way and hide the
controls but leave them on the page?
Yes
How would I set style="display:none" from asp.net?
The easiest thing would be to make a css class

..Invisible{display:none}

Then you could set

something.CssClass="Invisible"

or

something.Attributes("class")="Invisible".

You also can do

something.Attributes("style")="display:none"
Sep 10 '07 #7
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
>If I set the Panel display:none, will it work the same way and hide the
controls but leave them on the page?
Yes
>How would I set style="display:none" from asp.net?
The easiest thing would be to make a css class

.Invisible{display:none}

Then you could set

something.CssClass="Invisible"

or

something.Attributes("class")="Invisible".

You also can do

something.Attributes("style")="display:none"
That's what I needed to know.

Thanks,

Tom
Sep 10 '07 #8

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

Similar topics

0
by: Evin | last post by:
How can I access values from variables (global variables) from other running applications (Java Script in IE). I need to get the value using VB.NEt is it possible. B'coz the server generates...
5
by: Craig Anderson | last post by:
Can anyone tell me the best way to access a hidden object in a form? I could use a hard-coded index to the elements of the form, but it's too easy to add something before the hidden object and mess...
2
by: Niels Knabe | last post by:
To simplify the user interface and to protect code I have unchecked the Tools|Options|View|Show Hidden objects. However, if a user selects displaying the hidden objects, I would like to reset this...
0
by: Ersin Gençtürk | last post by:
hi , I am using internet explorer by referencing the shdocvw.dll , I can access DOM objects , but also I need to access jscript objects , for example an array object defined between the script...
2
by: Roger | last post by:
How can I access subreport objects from vba? Sample code would be appreciated.
1
by: shivakumarsms | last post by:
How to access hidden variables from frames
3
by: Bindia | last post by:
Hi, I would like to know how to access hidden value posted from another html page. For example. *I have 2 pages Page A and Page B. I have a hidden value 'hide' in page A. *When i click on a...
1
by: rupeshnyadav | last post by:
How to access Hidden variable in Javascript declared in Content Page
1
by: Jeff User | last post by:
hi all Using C#, .NET1.1. I need to pass a string of text to the final html output and then capture it with java script on the client side. I found that I can place my string in and then...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.