Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6235621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:42:07+00:00 2026-05-24T10:42:07+00:00

I have 3 ASP.NET textboxes and one HiddenField. The value of the third textbox

  • 0

I have 3 ASP.NET textboxes and one HiddenField.
The value of the third textbox (this is disabled) depends on the values of the other two.

The formula is

txtPricepad = txtPrice/txtCarton

<asp:TextBox ID="txtPriceCase" runat="server" onblur="javascript:GetPricePerPad();></asp:TextBox>
<asp:TextBox ID="txtCarton" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPricePad" Enabled="false" runat="server" ></asp:TextBox>
<asp:HiddenField ID="hdPricepad" runat="server"/>

  function GetPricePerPad()
  {
    var priceCase   = document.getElementById('ctl00_content_txtPriceCase').value;
    var cartons     = document.getElementById('ctl00_content_txtCarton').value;
    var res         = Number(priceCase) / Number(cartons);

    document.getElementById('ctl00_content_txtPricePad').value = res;
    document.getElementById('ctl00_content_hdPricepad').value = res;
  }

Assuming that the initial value of txtPricePad is 0 and txtCarton is 12.
When the value of txtPrice is changed to 1200, GetPricePerPad() will be called, thus txtPricePad will be 100.

Javascript successfully changed the txtPricePad’s value to 100 but when I am calling txtPricePad from the codebehind, its value is still 0.
That’s why I assigned also the result of the formula to a HiddenField. Are there other ways to do this? I do not want to use HiddenField again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:42:09+00:00Added an answer on May 24, 2026 at 10:42 am

    Liz, is it possible for you to make the text field readonly (ReadOnly=True) as opposed to making it Disabled=True? The reason being that when a text field is disabled is not submitted with the form in the POST request. See this question.

    If you want to make it look as if it was disabled, I guess you can apply a CssClass to the button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 textbox in my asp.net page and also have one hiddenfield in
I have two textboxes on an asp.net webpage, either one or both are required
I have one group of 3 asp.net textboxes and one group of 2 asp.net
I have two asp.net textboxes and need to put a validate function in javascript
I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have two textboxes, one isfor 'program' and the other for 'description'. I have
I have two textboxes with calendarextender and One Label. The first textbox represents the
I have to validate two asp.net text boxes. First one has input as :
I have an company asp.net website with textboxes which may contain several hundred words.
I have a simple in VB/ASP.NET form containing two text boxes, I am attempting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.