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

TextBox - no value if disabled?

hello,

is it expected behavior (in 1.1) for a disabled=true textbox to *not*
maintain its value upon postback?

if so, this is disappointing. often times in my app i need to "lock"
textboxes, reserving them for automated javascript entry only, not
manual. but id still like to pick up their values on postback.

i have work arounds i can employ, but i wanted to confirm this
behavior.
thanks,
matt

Jul 27 '06 #1
4 2157
Is it something that the user is supposed to see? Or not.

Usually if i have values i want to hide from the user, i will use the
following:
<input type=""hidden" id="hdnMyValue" runat="server" >
(in 2.0 there is actually an asp Hidden control type)
If you do want the user to see the box, then instead of disabling it, you
could set it to be ReadOnly.

How are you coding your textbox? Are your using
<asp:textbox id=txtMyBox runat=server enabled=false />
or are you using
<input type=textbox disabled=true />
<ma**@mailinator.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
hello,

is it expected behavior (in 1.1) for a disabled=true textbox to *not*
maintain its value upon postback?

if so, this is disappointing. often times in my app i need to "lock"
textboxes, reserving them for automated javascript entry only, not
manual. but id still like to pick up their values on postback.

i have work arounds i can employ, but i wanted to confirm this
behavior.
thanks,
matt

Jul 27 '06 #2

I'd concur that

ReadOnly on the textbox
and/or a
<asp:hidden>

are the 2 options for handling this.

<ma**@mailinator.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
hello,

is it expected behavior (in 1.1) for a disabled=true textbox to *not*
maintain its value upon postback?

if so, this is disappointing. often times in my app i need to "lock"
textboxes, reserving them for automated javascript entry only, not
manual. but id still like to pick up their values on postback.

i have work arounds i can employ, but i wanted to confirm this
behavior.
thanks,
matt

Jul 27 '06 #3
Yes, this is a browser side behavior (AFAIK likely accross most browsers).
The (bad ?) idea is likely that if the control is disabled you can't change
the value and consequently there is no need to post this (unchanged) value
to the server (probably designed this way back to low bandwidth/ no
javascript days)...

--
Patrice

<ma**@mailinator.coma écrit dans le message de news:
11**********************@h48g2000cwc.googlegroups. com...
hello,

is it expected behavior (in 1.1) for a disabled=true textbox to *not*
maintain its value upon postback?

if so, this is disappointing. often times in my app i need to "lock"
textboxes, reserving them for automated javascript entry only, not
manual. but id still like to pick up their values on postback.

i have work arounds i can employ, but i wanted to confirm this
behavior.
thanks,
matt

Jul 27 '06 #4

Patrice wrote:
Yes, this is a browser side behavior (AFAIK likely accross most browsers).
The (bad ?) idea is likely that if the control is disabled you can't change
the value and consequently there is no need to post this (unchanged) value
to the server (probably designed this way back to low bandwidth/ no
javascript days)...
ah, this is what i was looking for. as i mentioned i have work arounds,
but i wanted to make sure this was unchangeable behavior.
thanks,
matt

Jul 28 '06 #5

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

Similar topics

1
by: JS | last post by:
I have a textbox and a button. Sometimes this textbox will be disabled and other times it will be enabled. When its disabled I guess its value is null. But is the the text string "null" or is it...
4
by: Gill Smith | last post by:
After setting the web control text box enable property to FALSE makes the control to loose the data between round trip. I am making sure that the property - EnableViewState = TRUE. Same code...
1
by: Hardy Wang | last post by:
Guys, I have a web form with some <Asp:TextBox> controls, on some condition, I need to trigger a client side JavaScript to clean all values of these boxes, like below: function DisableForm() {...
0
by: sunny076 | last post by:
Hi, I am having difficulties creating a derived class for DisabledDataGridViewTextBoxColumn and cell when the VisualStyle is not supported. Basically I am down to either using ControlPaint or...
2
by: teddy.am | last post by:
Guys, I have a set of 6 radio buttons, infront of each one there's a textbox .... i need all textboxes disabled .... once one of the radio buttons is selected, the texbox infront of it will be...
3
by: BrendanMcPherson | last post by:
How can I get a listbox to change a textbox on some selections. I have a listbox which only needs to be filled in on some selections. Is there a way I can have on some selections the textbox go...
5
by: metalwing12 | last post by:
Hi guys can someone kindly help me about my code it seems incomplete or i just can make it right .I try using the disabled property of the textbox yes it workss, it disable it but when i set it...
2
by: metalwing12 | last post by:
hi guys can someone help me out here.im having a hard time doing this project well this is my code I try using the disabled property of the textbox yes it workss, it disable it but when i set it to...
2
by: Nowezo | last post by:
Hi, Can you please help me, I want to write a dropdown box that have an option 'Other' but when the Other is selected my textbox need to be enable and take the textbox value as an output instead of...
1
by: hal | last post by:
I have a web page using javascript to enable/disabled an image button and switch its image when values are entered into a couple of textboxes. I have all that working fine, but my code considers a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.