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. [newbie] Form does not retain values when refreshed

[newbie] Form does not retain values when refreshed

Scheduled Pinned Locked Moved ASP.NET
question
8 Posts 5 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.
  • J Offline
    J Offline
    jon 80
    wrote on last edited by
    #1

    Why doesn't this form retain the values when I key them in the textbox? I've tried with Mozilla and IE. CurrencyConvertor.aspx

    ]]>

    http://www.w3.org/TR/xhml11/DTD/xhtml11.dtd">

    Currency Converter

    	Convert:  
    	
    	  US Dollars to Euros.
    

    Jon

    C N K N 4 Replies Last reply
    0
    • J jon 80

      Why doesn't this form retain the values when I key them in the textbox? I've tried with Mozilla and IE. CurrencyConvertor.aspx

      ]]>

      http://www.w3.org/TR/xhml11/DTD/xhtml11.dtd">

      Currency Converter

      	Convert:  
      	
      	  US Dollars to Euros.
      

      Jon

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

      This is the ASP.NET forum. You've posted HTML. HTML is client side only, there is no mechanism there for saving state. I suggest you buy a book on ASP.NET and work through it.

      Christian Graus Driven to the arms of OSX by Vista.

      J 1 Reply Last reply
      0
      • C Christian Graus

        This is the ASP.NET forum. You've posted HTML. HTML is client side only, there is no mechanism there for saving state. I suggest you buy a book on ASP.NET and work through it.

        Christian Graus Driven to the arms of OSX by Vista.

        J Offline
        J Offline
        jon 80
        wrote on last edited by
        #3

        Thanks, that's just what I was doing.

        Jon

        1 Reply Last reply
        0
        • J jon 80

          Why doesn't this form retain the values when I key them in the textbox? I've tried with Mozilla and IE. CurrencyConvertor.aspx

          ]]>

          http://www.w3.org/TR/xhml11/DTD/xhtml11.dtd">

          Currency Converter

          	Convert:  
          	
          	  US Dollars to Euros.
          

          Jon

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          You aren't using any server controls. ASP.NET use a mechanism called ViewState to maintain the values of a page. Try converting the input types to runat=server or change it to ASP.NET server control.

          Navaneeth How to use google | Ask smart questions

          J 1 Reply Last reply
          0
          • J jon 80

            Why doesn't this form retain the values when I key them in the textbox? I've tried with Mozilla and IE. CurrencyConvertor.aspx

            ]]>

            http://www.w3.org/TR/xhml11/DTD/xhtml11.dtd">

            Currency Converter

            	Convert:  
            	
            	  US Dollars to Euros.
            

            Jon

            K Offline
            K Offline
            knbinoj58
            wrote on last edited by
            #5

            Use aspx controls and enable viewstate...

            J 1 Reply Last reply
            0
            • K knbinoj58

              Use aspx controls and enable viewstate...

              J Offline
              J Offline
              jon 80
              wrote on last edited by
              #6

              I've tried rebuilding from scratch, and scouted the web unsuccessfully trying to find a solution. In my code I had updated the attributes so that they are converted to server controls, hence, processed by the server. In the previous version, I was viewing the page successfully; within the source tag, I'm seeing the _VIEWSTATE, hence, assuming that view state is already enabled. Am I doing something wrong? I've noted that: 1. the control "US" is not recognized by Intellisense (see .cs file below) 2. when I load the webpage an error is displayed; this was not displayed before Compiler Error Message: CS0115: 'ASP.currencyconvertor_aspx.GetTypeHashCode()': no suitable method found to override Detailed error below. :confused:

              CurrencyConvertor.aspx
              ]]>

              Currency Converter

              	Convert:  
              	
              	  US Dollars to Euros.
              	  
              
              	
              	onserverclick="Convert\_ServerClick" />
              

              CurrencyConvertor.aspx.cs
              public partial class html_CurrencyConvertor : System.Web.UI.Page
              {
              protected void Page_Load(object sender, EventArgs e)
              {
              //decimal USAmount = Decimal.Parse(US....
              //here I'm expecting the id US to be displayed within Intellisense, becauase
              //I've declared it within the .aspx file.
              }
              }

              // The following HTML source code from previous version

              http://www.w3.org/TR/xhml11/DTD/xhtml11.dtd">

              Currency Converter

              	Convert:  
              	
              	  US Dollars to Euros.
              

              Error: Server Error in '/CurrencyConvertor' Application. Compilation Error Description: An error occurred

              1 Reply Last reply
              0
              • J jon 80

                Why doesn't this form retain the values when I key them in the textbox? I've tried with Mozilla and IE. CurrencyConvertor.aspx

                ]]>

                http://www.w3.org/TR/xhml11/DTD/xhtml11.dtd">

                Currency Converter

                	Convert:  
                	
                	  US Dollars to Euros.
                

                Jon

                N Offline
                N Offline
                Nishant Singh
                wrote on last edited by
                #7

                try runat="server" for ur form controls

                1 Reply Last reply
                0
                • N N a v a n e e t h

                  You aren't using any server controls. ASP.NET use a mechanism called ViewState to maintain the values of a page. Try converting the input types to runat=server or change it to ASP.NET server control.

                  Navaneeth How to use google | Ask smart questions

                  J Offline
                  J Offline
                  jon 80
                  wrote on last edited by
                  #8

                  The runat="server" are already in my code. It's noted that my previous post doesn't appear here, did I do something wrong?

                  Jon

                  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