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. Ho to access the HTML control

Ho to access the HTML control

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netdatabasehelp
6 Posts 4 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
    Sheel Gohe
    wrote on last edited by
    #1

    Hi Friends, I have a query, how can we access the HTML control from ASP.NET code behind. "FindControl" is throwing error. Thanks in advance Sheel Gohe

    M C 2 Replies Last reply
    0
    • S Sheel Gohe

      Hi Friends, I have a query, how can we access the HTML control from ASP.NET code behind. "FindControl" is throwing error. Thanks in advance Sheel Gohe

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Is the element marked with the attribute runat="server"?

      S 1 Reply Last reply
      0
      • S Sheel Gohe

        Hi Friends, I have a query, how can we access the HTML control from ASP.NET code behind. "FindControl" is throwing error. Thanks in advance Sheel Gohe

        C Offline
        C Offline
        CWIZO
        wrote on last edited by
        #3

        Read this please. -------------------------------------------------------- My development blog Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!

        1 Reply Last reply
        0
        • M Mike Ellison

          Is the element marked with the attribute runat="server"?

          S Offline
          S Offline
          Sheel Gohe
          wrote on last edited by
          #4

          No mike its not marked with the attribute runat="server"? its purely a html control " Any solutions.... Sheel Gohe

          D M 2 Replies Last reply
          0
          • S Sheel Gohe

            No mike its not marked with the attribute runat="server"? its purely a html control " Any solutions.... Sheel Gohe

            D Offline
            D Offline
            dansoft
            wrote on last edited by
            #5

            Please try the following code Request.Form.GetValues("chkSelect")

            1 Reply Last reply
            0
            • S Sheel Gohe

              No mike its not marked with the attribute runat="server"? its purely a html control " Any solutions.... Sheel Gohe

              M Offline
              M Offline
              Mike Ellison
              wrote on last edited by
              #6

              If you want to manipulate a server control or HTML element through server-side code, you must mark the element with the attribute runat="server". In your case, you could certainly have the following:

              <input type="checkbox" id="chkSelect" runat="server"/>

              Server-side then, the chkSelect object would be identified as the type System.Web.UI.HtmlControls.HtmlInputCheckBox, and you could inspect or manipulate it's properties (lookup HtmlInputCheckBox on MSDN for a reference). You could certainly use a <asp:Checkbox id="chkSelect" runat="server"/> control instead. Any reason you're not?

              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