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. TextChange Event on a collection of textboxes [modified]

TextChange Event on a collection of textboxes [modified]

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

    I have a collection of 50 textboxes. I was wounding if it is possible to run a TextChange Event on a collection of textboxes instead having to add each event handler in individually. The code behind is VB

    modified on Tuesday, March 24, 2009 12:02 PM

    M J 2 Replies Last reply
    0
    • R Ragonastick

      I have a collection of 50 textboxes. I was wounding if it is possible to run a TextChange Event on a collection of textboxes instead having to add each event handler in individually. The code behind is VB

      modified on Tuesday, March 24, 2009 12:02 PM

      M Offline
      M Offline
      Milind R Chavan
      wrote on last edited by
      #2

      Hi, If the text boxes are not dynamic then it is very easy to make that as : so on and so forth .... in code behind protected void TextBox_TextChanged(object sender, EventArgs e) { TextBox txt = ((System.Web.UI.WebControls.TextBox)(sender)); } you can easily get which textbox changed event is called Regards, Milind

      1 Reply Last reply
      0
      • R Ragonastick

        I have a collection of 50 textboxes. I was wounding if it is possible to run a TextChange Event on a collection of textboxes instead having to add each event handler in individually. The code behind is VB

        modified on Tuesday, March 24, 2009 12:02 PM

        J Offline
        J Offline
        jokerkachotabhai
        wrote on last edited by
        #3

        U must have assigned ID to all of ur textboxes whether u create it dynamically or us it beforehand as a static control so u can create a centralized event handler for all ur textboxes for eg. if i have two textboxes with their ID as say t1 and t2 respectively then i will use this method to act as a centralized event handler for textchange d event of both as void TextBox_TextChanged(object sender,EventArgs e) { TextBox t = (TextBox)sender; switch(t.ID) { case "t1": Response.Write("Text Changed in t1"); break; case "t2": Response.Write("TextChanged in t2"); break; } }

        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