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. Problem auto tabbing

Problem auto tabbing

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

    Hi all. I have a problem auto-tabbing. I need the text boxes on my form to auto-tab to the next textbox when they're full. I can do this using JavaScript and input controls, but unfortunately, I need to get at the contents of the text boxes using the code behind page. (And I can not for the life of me figure out how to call javascript from an asp:textbox control.) Does anyone have any suggestions of examples on how to do this? (I couldn't find anything that worked with google :/ ) - Munty

    V 1 Reply Last reply
    0
    • M Muntyness

      Hi all. I have a problem auto-tabbing. I need the text boxes on my form to auto-tab to the next textbox when they're full. I can do this using JavaScript and input controls, but unfortunately, I need to get at the contents of the text boxes using the code behind page. (And I can not for the life of me figure out how to call javascript from an asp:textbox control.) Does anyone have any suggestions of examples on how to do this? (I couldn't find anything that worked with google :/ ) - Munty

      V Offline
      V Offline
      VenkataRamana Gali
      wrote on last edited by
      #2

      try this code behind function public static void SetFocus(Control control) { StringBuilder sb = new StringBuilder(); sb.Append("\r\n\r\n"); sb.Append("<!--\r\n"); sb.Append("function SetFocus()\r\n"); sb.Append("{\r\n"); sb.Append("\tdocument."); Control p = control.Parent; while (!(p is System.Web.UI.HtmlControls.HtmlForm)) p = p.Parent; sb.Append(p.ClientID); sb.Append("['"); sb.Append(control.UniqueID); sb.Append("'].focus();\r\n"); sb.Append("}\r\n"); sb.Append("window.onload = SetFocus;\r\n"); sb.Append("// -->\r\n"); sb.Append(""); control.Page.RegisterClientScriptBlock("SetFocus", sb.ToString()); } write this code in html view <!-- function SetFocus() { document.Form1['TextBox1'].focus(); } window.onload = SetFocus; // --> write this code at code behind PageUtility.SetFocus(TextBox1);

      regards GV Ramana

      M 1 Reply Last reply
      0
      • V VenkataRamana Gali

        try this code behind function public static void SetFocus(Control control) { StringBuilder sb = new StringBuilder(); sb.Append("\r\n\r\n"); sb.Append("<!--\r\n"); sb.Append("function SetFocus()\r\n"); sb.Append("{\r\n"); sb.Append("\tdocument."); Control p = control.Parent; while (!(p is System.Web.UI.HtmlControls.HtmlForm)) p = p.Parent; sb.Append(p.ClientID); sb.Append("['"); sb.Append(control.UniqueID); sb.Append("'].focus();\r\n"); sb.Append("}\r\n"); sb.Append("window.onload = SetFocus;\r\n"); sb.Append("// -->\r\n"); sb.Append(""); control.Page.RegisterClientScriptBlock("SetFocus", sb.ToString()); } write this code in html view <!-- function SetFocus() { document.Form1['TextBox1'].focus(); } window.onload = SetFocus; // --> write this code at code behind PageUtility.SetFocus(TextBox1);

        regards GV Ramana

        M Offline
        M Offline
        Muntyness
        wrote on last edited by
        #3

        I'm using VB as the code behind language :) there is no PageUtility function either. :/ For now im sticking with the tags, as I can get auto tabing to work. My next problem is getting the tags to clear after the page has loaded. (I can't do it on submit because that will clear all of the form, which I don't want. And i cant have a seperate form, because ASP only allows me one form that can run at the server. help! - Munty

        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