?
Solved

asp textboxt visible=false postback

Posted on 2009-07-06
5
Medium Priority
?
208 Views
Last Modified: 2013-12-17
I have an ASP textbox in which I am storing a value in between postback.

When I set the visible property of the textbox to True the value remains between postback. When I set the visible property to False, the stored value in the textbox is not kept.

The view state property of the textbox it set to true.

I am not sure why this is happening, can anybody help?

Thanks
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 9

Accepted Solution

by:
Rahul Goel ITIL earned 2000 total points
ID: 24783924
You use Hidden fields for that...Do not use textboxes
0
 

Author Comment

by:Mr_Shaw
ID: 24783940
I thought hidden fields were only in HTML on ASP
0
 

Author Comment

by:Mr_Shaw
ID: 24783944
ah.. spotted it...

i'll give it go.
0
 
LVL 4

Expert Comment

by:vbgb
ID: 24783948
When you set the ASP textbox visible property to false, the server generates the page without the box, which is why any value is lost on postback. If you try to access a hidden textbox using javascript it will throw an error because as far as the browser is concerned the textbox simply doesn't exist.

To save a value on postback you need to replace the textbox with a 'HiddenField'. This exists on the page when rendered to the client browser, but is always hidden. Any value stored in it will be retaiined on poastback, but the user cannot see or edit the value.

0
 

Author Closing Comment

by:Mr_Shaw
ID: 31600091
thanks
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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