How to get value from a disabled HTML text box from code behind?

I have a series of HTML textbox that are enabled / disabled by way of a check box calling a javascript funciton. Each textbox has the attribute runat="server" to allow codebehind to interact. Reading the values form the textboxes isn't a problem when they are enabled using:


However, when the textboxes are disabled, I cannot read the values. Each value = nothing.

Does anyone know a workaround for this?



2/6/2007 5:45:28 PM 93655 articles. 5 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 12

Disabled controls don't get submitted back to the server so ASP.Net doesn't have values for them. One way around this is to put submitdisabledcontrols="true" on your form tag. This is only valid in ASP.Net 2.0 so if you aren't running 2.0 you can't use it. If you aren't using 2.0 another option is to set up hidden input controls and maintain the values for the textboxes in those in your javascript and then on the server side use those values.
If this post answered your question please remember to 'Mark as Answer'!
2/6/2007 6:09:38 PM


Thanks so much! I haven't ported this application over to 2.0 yet - too big, too little time.

 But you did send me in the right direction. I didn't realize that disabled HTML controls were not submitted to the server. Once I read that, I simply set the controls to readOnly instead. Worked like a charm!

 Thanks again!


2/6/2007 7:15:51 PM

Check this link


Mark post(s) as "Answer" that helped you

Electronic Screw
2/6/2007 7:24:16 PM

Similar Artilces:

Getting error while disabling the text boxes on Web Form
Hello Folks...THis is very urgent ...Plz help...Following is a piece of disable all the textBoxes on a WebForm in ASP.Net.(Lang:VB.Net) Private Sub disableAllTextBoxes(ByVal ControlArray) Dim control As Object Dim temptxtbox Dim i As Integer For Each control In ControlArray       If control.GetType.Name = "TextBox" Then          control.GetType.GetTypeArray(control).CopyTo(temptxtbox, 0)          For i = 0 To UBound(temptxtbox)     &n...

how to get an html check box checked value in code behind.
iam having a grid where i palced a check box in the grid header .now how can i get the checked state of the control in a button clicked Hi, CheckBox chk =GridControl1.Control.FindControl("ChkId"); Where chkId is the id of the checkbox that you have in the grid control. Then check that if(chk.Checked) {"Do something here"}. Regards Ramesh   Dim chk As CheckBox = GridView1.HeaderRow.FindControl("CheckBox1") If chk.Checked Then ''.... End If Regards,Anas Ghanem.Note:Please Don't hesitate to click...

get html textbox value in behind)
  i am new to Can anybody say how to get Input textbox value in b4 sending answer Thankx  string value = Resquest.Form["textboxname"].ToString(); Hi,There are two ways to access it. 1) Make it runat="server" and access it in code behind like textbox1.value2) Another way is by using     Request.Form["textbox1"].ToString(); I hope this will be helpful to you.Thanks, Alpesh DhaneshaPlease don't forget to "Mask as Answer" if it helped. just add runat =server to html  ...

VB .net Web Form will not get contents of Text Box
I have created a web form with text boxes that are bound to a DataSet/DataView.  I have created button to navigate up and down the recordset.  That all works fine. I need to have the ability to edit/add text in any of the boxes and then when clicking "Save" button, it would build an UPDATE query to send to the database. When the Save button is clicked, I have coded to DIM a string var (strSQL) to use to build the SQL command.  For some reason, it will only get the text from a text box if the data was pulled the database.  If I add/edit data, then the SQL command will ha...

Load Text box of one web form with selected list item of list box of another web form
one help please Problem is i have two web forms  1.  ForiegnkeyTest.aspx  2. foroginkeytable.aspx   step 1 1 ForiegnkeyTest.aspx one web form <head runat="server"><script language="javascript" type="text/javascript">   function popWin()   {         var confirmWin = null;      confirmWin ='foroginkeytable.aspx','anycontent',   'width=455,height=435,status');   }  </script> &...

how to get the disabled text box value???
Hi I need to get the disabled text box value, when i am trying to access with x=txtName.text ; it's not returning anything when it is disabled. I can not use request["txtName"]; thanks sridhar I don't see any problems to get value from disabled textbox. I created textbox and disabled it both ways (in properties and programmatically), and I can get value without any problems. Looks like you have other problems. hi, the enabled / disabled property does not affect the value! string text=mytextbox.text should work!...

How to get the values from the HTML text box
I have a HTML text box (NOT a TextBox server control) ina .aspx page and a button server control. Is it possiblewith ASP.NET to get the value of the HTML text box when Iclick the button? How can I get the value of an HTMLelement from VB on the server? ''''''''''''''''''''''''''''''The Code''''''''''''''''''''''''''''''''''''&#...

Web Forms Designer error
Hi, The web forms designer keeps adding things in a generated InitializeComponent() method. I believe these things shouldn't be there because I've made a new webform with the same code that doesn't add the same stuff. Is there anyway I can see the Web Designer code? Thanks. Just expand out the hidden #region. It is labeled Web Form Designer CodeStarting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog...

How to get Value of teh Input type text box created using html and writing this html in label control.
Hi,i created a input control like this pdr is datarow strPricing = strPricing & "<Table cellSpacing=""1"" cellPadding=""1"" border=""0""> "For Each pdr In dsPricing.Tables(0).RowsstrPricing = strPricing & "<TR> "strPricing = strPricing & "<TD style=''WIDTH: 130px; FONT-SIZE: 10pt; FONT-FAMILY: Arial''>' & Convert.ToString(pdr.Item('OptionCode')) & '</TD>'strPricing = strPricing & "<TD align=""left"" style=''WIDTH: 110px''><...

Html input text value in code behind
I am very new to I have a html input text box (txtFromDate), I am populating it from a calendar control from another aspx page. I want to validate the value of the input text on some button click event in the current Code behind page. How Do I do it. I have tried making the input text box as server control,  declaring the id attribute. Then Declaring the html imput text as protected in the code behind page. I am able to see the instance of the html input box. I am able to populate the value into the html input text. But on the btnValidate click event when i tried accessi...

How to get html input value in code behind?
 Hello all,I have dynamically created <input type="text" > in client side.the id for such generated input type text are say price1,price2,price3 and so on.What i need is to retrive the value of those input text boxes in code behind?Note that those controls are simple html <input type="text"> not server controls.thanks.Bibek  With Request.Form["price1"] you will get the name of the textfield with id price1.If you are using VB.NET then the syntax is: Request.Form("price1")If this post was useful to you, please mark it as answer. T...

getting html hidden controls value in code behind
hii need to get a value of html hidden control which is not set to runat server and i also dont have its id only name is getting.<input type=hidden name=refid value="1">Request.form["refid"] is not working. socan u sugges some idearegardsmax In, there is a control called a HiddenField control.Have you thought of using that?Also - is this posting to another page? if so - which post method?Many times, I've seen people use Request.form when they needed Request.QuerystringDavid WierMCP/ - where to look first!Please Vote for ASPNet10...

Get whole html page with values in Code behind.
Hello,  I want to get all HTML code with values entered by user in code behind as it is, Actully this need has arised when I want to send a mail to a given mail id, the whole HTML page as it is (same UI) with entered values.   For this I hv written following code, but it only gives the HTML and not the values user has entered. ------------------------------------------------------------------------------------------------------------------------------------------------------ private...

Altering Input or Text box values in code behind
I'm new to Atlas and have been having trouble figuring out how I can have the code behind update the value in a regular HTML Input field or an asp:TextBox.  Basically what I'm looking for is you click a button and it will update the values.Also I've seen in several forum posts people using controls like atlas:label or atlas:textbox but I don't have access to those.  What am I missing? Hi,atlas:label, atlas:textbox and other server control have been removed and don't exist in the current CTP. Can you describe your requirements in detail?Alessandro Gallo | Blog | My book: ASP.NET A...

Web resources about - How to get value from a disabled HTML text box from code behind? -

Disabled sports - Wikipedia, the free encyclopedia
Disabled sports also adaptive sports or parasports , are sports played by persons with a disability , including physical and intellectual disabilities ...

Facebook Disabled Website At HQ, Prompting Employees To Use Mobile
Facebook has been big on dogfooding its employees , and it appears the latest round came when the company shut off its website internally, forcing ...

Viral Channels: Email to be Disabled by Default with Profile Redesign
In a recent note to developers, Facebook announced that because app emails have been so spammy, user emails will be turned off by default when ...

American Veterans Disabled for Life Memorial - Flickr - Photo Sharing!
It's been a long time coming, but it's finally here. A well-deserved addition to DC's Memorials.

How Jailbreaking can improve the lives of the disabled - YouTube
In this video, RMalayeri interviews the developer behind famed Jailbreak app WiFiSMS. The interview showcases how @treasosn's app has served ...

Rheumatoid arthritis: ‘It can be extremely destructive. If left untreated people can be completely disabled’ ...
Early treatment of the condition is crucial as if left undiagnosed, rheumatoid arthritis can lead to disability and deformity, doctors say.

Disabled cop Ryan Marron reaches out to help fellow officers
Ryan Marron, the WA police officer left disabled by a mosquito bite, has launched a campaign to help all his fellow officers injured in the line ...

Acts of kindness aren't enough: disabled people need acts of leadership
Let's make 2015 a year when advocacy is met with tangible changes in planning and access for people with disabilities, so we can all ride together. ...

Man charged over alleged assault of disabled woman on Sydney bus
&#65279;A man has been charged over the alleged assault of a disabled woman in Green Valley in Sydney's west.

Islamic State Issues Fatwa Against Children with Down Syndrome, Murders 38 Disabled Infants
The Islamic State has reportedly issued a fatwa ordering the elimination of children with Down syndrome and other congenital disabilities.

Resources last updated: 1/8/2016 8:39:17 AM