Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. TextBox.text not showing in code behind

TextBox.text not showing in code behind

Scheduled Pinned Locked Moved ASP.NET
htmldebugginghelpquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DerekFL
    wrote on last edited by
    #1

    I have a simple login form that uses a master page. Im having a weird problem where when the login button is clicked the code behind cannot see the txtUserName.Text The text box html is The code behind is Dim currentUser As New DAL.AppUser currentUser = currentUser.AuthenticateUser(txtUsername.Text, txtPassword.Text) If currentUser.AppUserId > 0 Then .... When I set a breakpoint at currentUser =... I see txtPassword.Text value but txtUsername.Text shows "" even though it is filled. I checked that its view state is enabled. Tried deleting it and re-adding. Very weird. Has anyone ever had this problem?

    L K C 3 Replies Last reply
    0
    • D DerekFL

      I have a simple login form that uses a master page. Im having a weird problem where when the login button is clicked the code behind cannot see the txtUserName.Text The text box html is The code behind is Dim currentUser As New DAL.AppUser currentUser = currentUser.AuthenticateUser(txtUsername.Text, txtPassword.Text) If currentUser.AppUserId > 0 Then .... When I set a breakpoint at currentUser =... I see txtPassword.Text value but txtUsername.Text shows "" even though it is filled. I checked that its view state is enabled. Tried deleting it and re-adding. Very weird. Has anyone ever had this problem?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Try capital ID and make sure the ID value is unique on the page <asp:textbox ID="txtUsername" runat="server" /> Wait, nevermind, you're using VB, could be anything then. :rolleyes:

      led mike

      1 Reply Last reply
      0
      • D DerekFL

        I have a simple login form that uses a master page. Im having a weird problem where when the login button is clicked the code behind cannot see the txtUserName.Text The text box html is The code behind is Dim currentUser As New DAL.AppUser currentUser = currentUser.AuthenticateUser(txtUsername.Text, txtPassword.Text) If currentUser.AppUserId > 0 Then .... When I set a breakpoint at currentUser =... I see txtPassword.Text value but txtUsername.Text shows "" even though it is filled. I checked that its view state is enabled. Tried deleting it and re-adding. Very weird. Has anyone ever had this problem?

        K Offline
        K Offline
        keyboard warrior
        wrote on last edited by
        #3

        Dim currentUser As New DAL.AppUser currentUser = currentUser.AuthenticateUser(txtUsername.Text, txtPassword.Text) If currentUser.AppUserId > 0 Then ===================================== where is this in the code behind? is this on page load? or page init? when the page is submit and then loads those text boxes will be blank when the code goes for them. also when you step through the application and you go one step past the txtUsername, what is the value then? is it still "" for currentUser?

        ----------------------------------------------------------- "When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford

        D 1 Reply Last reply
        0
        • K keyboard warrior

          Dim currentUser As New DAL.AppUser currentUser = currentUser.AuthenticateUser(txtUsername.Text, txtPassword.Text) If currentUser.AppUserId > 0 Then ===================================== where is this in the code behind? is this on page load? or page init? when the page is submit and then loads those text boxes will be blank when the code goes for them. also when you step through the application and you go one step past the txtUsername, what is the value then? is it still "" for currentUser?

          ----------------------------------------------------------- "When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford

          D Offline
          D Offline
          DerekFL
          wrote on last edited by
          #4

          The code behind is on login.click button event

          K 1 Reply Last reply
          0
          • D DerekFL

            The code behind is on login.click button event

            K Offline
            K Offline
            keyboard warrior
            wrote on last edited by
            #5

            if i had to guess it's because the page is posting back to itself when "login" is clicked and then you're code to collect the information is processing after the post back. otherwise...i have no idea :(

            ----------------------------------------------------------- "When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford

            D 1 Reply Last reply
            0
            • D DerekFL

              I have a simple login form that uses a master page. Im having a weird problem where when the login button is clicked the code behind cannot see the txtUserName.Text The text box html is The code behind is Dim currentUser As New DAL.AppUser currentUser = currentUser.AuthenticateUser(txtUsername.Text, txtPassword.Text) If currentUser.AppUserId > 0 Then .... When I set a breakpoint at currentUser =... I see txtPassword.Text value but txtUsername.Text shows "" even though it is filled. I checked that its view state is enabled. Tried deleting it and re-adding. Very weird. Has anyone ever had this problem?

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              I think it's asp:TextBox, does the other one work with this capitalisation ? Do you have code that sets the username value anywhere, such as page_load ?

              Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              D 1 Reply Last reply
              0
              • K keyboard warrior

                if i had to guess it's because the page is posting back to itself when "login" is clicked and then you're code to collect the information is processing after the post back. otherwise...i have no idea :(

                ----------------------------------------------------------- "When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford

                D Offline
                D Offline
                DerekFL
                wrote on last edited by
                #7

                I tried setting AutoPostBack to true and setting a string var on the txtUesrName_TextCahnged event but it show TxtUsrName.Text as NULL also so I am pissed at this point. Its a copy of another site that works fine. It must be some corruption in the asp page.

                1 Reply Last reply
                0
                • C Christian Graus

                  I think it's asp:TextBox, does the other one work with this capitalisation ? Do you have code that sets the username value anywhere, such as page_load ?

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  D Offline
                  D Offline
                  DerekFL
                  wrote on last edited by
                  #8

                  I rebuilt the whole page and problem fixed.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups