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. General Programming
  3. C#
  4. Retrieve Value from TextBox Which is created in the code behind

Retrieve Value from TextBox Which is created in the code behind

Scheduled Pinned Locked Moved C#
help
3 Posts 3 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.
  • H Offline
    H Offline
    HatakeKaKaShi
    wrote on last edited by
    #1

    Hi Guys Need Help. I am using a dynamic created Textbox in code behind However when i wanna retrieve the value from the Textbox which i have created, I always seem to hit an error and stuck at the part of retrieving value Any sample or advise will be a blessing to me Thanks A Millions

    KaKaShi HaTaKe

    J A 2 Replies Last reply
    0
    • H HatakeKaKaShi

      Hi Guys Need Help. I am using a dynamic created Textbox in code behind However when i wanna retrieve the value from the Textbox which i have created, I always seem to hit an error and stuck at the part of retrieving value Any sample or advise will be a blessing to me Thanks A Millions

      KaKaShi HaTaKe

      J Offline
      J Offline
      John Gathogo
      wrote on last edited by
      #2

      You add the textbox using Controls.Add(). When creating the textbox from codebehind, you can assign it an ID say, tbDynamicId.

      TextBox tb = new TextBox();
      tb.ID = "tbDynamicId";
      this.Controls.Add(tb); //To add the the current form

      Then you can get the textbox like:

      TextBox tbDynamic = (TextBox)FindControl("tbDynamicId");

      And then retrive the value normally,

      String value = tbDynamic.Text;

      1 Reply Last reply
      0
      • H HatakeKaKaShi

        Hi Guys Need Help. I am using a dynamic created Textbox in code behind However when i wanna retrieve the value from the Textbox which i have created, I always seem to hit an error and stuck at the part of retrieving value Any sample or advise will be a blessing to me Thanks A Millions

        KaKaShi HaTaKe

        A Offline
        A Offline
        alrosan
        wrote on last edited by
        #3

        string text = ((TextBox)this.Controls["ControlName"]).Text;

        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