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. how to keep the text in a textbox shown?

how to keep the text in a textbox shown?

Scheduled Pinned Locked Moved ASP.NET
questiontutorial
2 Posts 2 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.
  • S Offline
    S Offline
    Seraph_summer
    wrote on last edited by
    #1

    I have a textbox in the masterpage, then I input some text and click one button to redirect to another page, then the text in this textbox dispears, my question is that how to keep the text displayed even after redirect to annother page? I find one solution by using ((TextBox)Master.FindControl("TextBox_my")).Text =text_input; but later, I try to change the text and click the button again, the text in this textbox will be never changed and is always the original one. anyone can tell me why and any other solutions? thanks.

    A 1 Reply Last reply
    0
    • S Seraph_summer

      I have a textbox in the masterpage, then I input some text and click one button to redirect to another page, then the text in this textbox dispears, my question is that how to keep the text displayed even after redirect to annother page? I find one solution by using ((TextBox)Master.FindControl("TextBox_my")).Text =text_input; but later, I try to change the text and click the button again, the text in this textbox will be never changed and is always the original one. anyone can tell me why and any other solutions? thanks.

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Well Seraph, The only case that your textbox value doesnt appear to the server side may arise if you textbox is either Enabled = "false" or Readonly = "true" 1 In case of <asp:textbox Enabled="false" The form that holds the textbox doesnt submit itself. So the textbox will always appear to contain ""(Empty string) in the server side. 2. In case of <asp:textbox ReadOnly="true" The form submits the textbox, but always the original value which is used to create the form retains in the server side. Thus any changes to the control doesnt appear. Check whether your textbox is enabled or Readonly. To transmit text from one page to another you might use querystring. Just place in your address yourpage.aspx?x=name&y=age But if the text is coming from the database, I would rather recommend you to fetch it from database every time, because, as this is web, the user might paste the link directly to the address bar rather than coming from the previous page. :cool::cool:

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      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