Value of Textbox remains initially but Value of Textbox changed while inspect elements RRS feed

  • Question

  • User944339287 posted

    Hi guys, I'm using Javascript to increase TextBox Value (0 to 1) and it's working fine.

    The following is the result when I inspect (Ctrl + Shift + I) TextBox Control from the browser. The value is changed accordingly (0 to 1) as well.

    <input name="ctl00$body$txt_product_option0" value="1" id="body_txt_product_option0" type="number">

    But it remains the initial value 0 in Code-Behind (txt.Text). Any idea?

    If Me.Panel1.Controls.Count > 0 Then
       For i As Integer = 0 To Me.Panel1.Controls.Count - 1
          Dim txt As TextBox = Me.Panel1.FindControl("txt_product_option" & i)
          If IsNothing(txt) = False Then
             If CDbl(txt.Text) > 0 Then
                // do something if txt.Text > 0 //
             End If
          End If
    End If

    Tuesday, December 31, 2019 10:19 AM

All replies

  • User475983607 posted

    The first step is using the browser's dev tools to see what value is submitted in the POST.  If a zero is submitted then you have a problem on the client.  If a one is submitted then you have a bug on the server side and should use the Visual Studio debugger to troubleshoot your code.

    If you want the community to debug your code then post enough code to reproduce this issue.  Otherwise the community can only guess.

    Tuesday, December 31, 2019 1:25 PM
  • User288213138 posted

    Hi kengkit,

    But it remains the initial value 0 in Code-Behind (txt.Text). Any idea?

    According to your description, i can't reproduce your question.

    please show me your code than can reproduce your question. such as aspx(include Javascript) and aspx.cs.

    Best regards,


    Wednesday, January 1, 2020 2:28 AM