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. Advice on filling a textbox

Advice on filling a textbox

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorial
4 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.
  • E Offline
    E Offline
    eyeseetee
    wrote on last edited by
    #1

    Hey guys Ive got a problem Ive got a gridview which has a textbox in one of the columns. On my OnRowDataBound event I check 7 fields in a database and then which ever ones have data in I add a letter to the textbox, for example if two fields have data in I would add A and G. The problem is at the moment I have 7 different if statements and each one adds a letter but they are overwriting the previous letter instead of adding to it, is there a way to add the letter to the textbox without overwriting the preivous. I know the whole concept im describing does sound silly but trust me it makes sense when the app runs. thanks in advance! :-D

    We are not a Code Charity

    N M 2 Replies Last reply
    0
    • E eyeseetee

      Hey guys Ive got a problem Ive got a gridview which has a textbox in one of the columns. On my OnRowDataBound event I check 7 fields in a database and then which ever ones have data in I add a letter to the textbox, for example if two fields have data in I would add A and G. The problem is at the moment I have 7 different if statements and each one adds a letter but they are overwriting the previous letter instead of adding to it, is there a way to add the letter to the textbox without overwriting the preivous. I know the whole concept im describing does sound silly but trust me it makes sense when the app runs. thanks in advance! :-D

      We are not a Code Charity

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

      .netman wrote:

      a way to add the letter to the textbox without overwriting the preivous.

      Find the texbox and append the text ? TextBox1.Text += "Your new Text"

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

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

        .netman wrote:

        a way to add the letter to the textbox without overwriting the preivous.

        Find the texbox and append the text ? TextBox1.Text += "Your new Text"

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        E Offline
        E Offline
        eyeseetee
        wrote on last edited by
        #3

        Thanks that worked, so simple yet couldnt think of it! :)

        We are not a Code Charity

        1 Reply Last reply
        0
        • E eyeseetee

          Hey guys Ive got a problem Ive got a gridview which has a textbox in one of the columns. On my OnRowDataBound event I check 7 fields in a database and then which ever ones have data in I add a letter to the textbox, for example if two fields have data in I would add A and G. The problem is at the moment I have 7 different if statements and each one adds a letter but they are overwriting the previous letter instead of adding to it, is there a way to add the letter to the textbox without overwriting the preivous. I know the whole concept im describing does sound silly but trust me it makes sense when the app runs. thanks in advance! :-D

          We are not a Code Charity

          M Offline
          M Offline
          Member 3301325
          wrote on last edited by
          #4

          just store the previos value in some temporary variable and set all to the text box at once. or at the time when you are setting value at the text box consider existing value also eg

          text1.text += text1.text + "a"

          (C# sample)

          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