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. html controls access on server side??

html controls access on server side??

Scheduled Pinned Locked Moved ASP.NET
questionjavascripthtmlsysadmin
13 Posts 5 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.
  • T TintinV3ck

    if i add the runat attribute, document.getElementById('imgPic').src doesnt work anymore because the id tag changes to cl00_imgPic. And I cant get it to work with getElementByName.

    Regards, Tintin

    _ Offline
    _ Offline
    _AK_
    wrote on last edited by
    #4

    where is the control placed in the webform? Are you using that inside of any other control.

    Best Regards, Apurva Kaushal

    T 1 Reply Last reply
    0
    • _ _AK_

      You just need to provide the runat and the id attbutes to access the html control in codebehind.

      Best Regards, Apurva Kaushal

      T Offline
      T Offline
      TintinV3ck
      wrote on last edited by
      #5

      sorry. document.getElementbyID im my Javascript (client side)

      Regards, Tintin

      _ 1 Reply Last reply
      0
      • _ _AK_

        where is the control placed in the webform? Are you using that inside of any other control.

        Best Regards, Apurva Kaushal

        T Offline
        T Offline
        TintinV3ck
        wrote on last edited by
        #6

        Regards, Tintin

        _ 1 Reply Last reply
        0
        • T TintinV3ck

          Regards, Tintin

          _ Offline
          _ Offline
          _AK_
          wrote on last edited by
          #7

          I dont fine any problem in accessing that in javascript. whta i have used is: var y = document.getElementById("imgPic").src; and this is html part:

          Best Regards, Apurva Kaushal

          1 Reply Last reply
          0
          • T TintinV3ck

            sorry. document.getElementbyID im my Javascript (client side)

            Regards, Tintin

            _ Offline
            _ Offline
            _AK_
            wrote on last edited by
            #8

            You can access that both in javascript and in code behind after putting ID and runat=server.

            Best Regards, Apurva Kaushal

            T 1 Reply Last reply
            0
            • T TintinV3ck

              Hi, How do I access an HTML control on my aspx's load event(code behind)? I've added a runat='server' to the control, but that buggers up my access to the control in javascript. What do I do?

              Regards, Tintin

              M Offline
              M Offline
              Mairy
              wrote on last edited by
              #9

              if you have such type of code to be used just add before the input or try to use this "asp: input type=text id=_name runat=server" this control will become server side control Mairy -- modified at 4:08 Tuesday 1st August, 2006

              1 Reply Last reply
              0
              • _ _AK_

                You can access that both in javascript and in code behind after putting ID and runat=server.

                Best Regards, Apurva Kaushal

                T Offline
                T Offline
                TintinV3ck
                wrote on last edited by
                #10

                tnx, seems to be working now.

                Regards, Tintin

                _ 1 Reply Last reply
                0
                • T TintinV3ck

                  tnx, seems to be working now.

                  Regards, Tintin

                  _ Offline
                  _ Offline
                  _AK_
                  wrote on last edited by
                  #11

                  always welcome :)

                  Best Regards, Apurva Kaushal

                  1 Reply Last reply
                  0
                  • T TintinV3ck

                    Hi, How do I access an HTML control on my aspx's load event(code behind)? I've added a runat='server' to the control, but that buggers up my access to the control in javascript. What do I do?

                    Regards, Tintin

                    P Offline
                    P Offline
                    Paddy Boyd
                    wrote on last edited by
                    #12

                    You can use the clientID property of the control on the server side to output the correct ID for the javascript function. Just output it in some script to the page as a var or something...

                    1 Reply Last reply
                    0
                    • T TintinV3ck

                      if i add the runat attribute, document.getElementById('imgPic').src doesnt work anymore because the id tag changes to cl00_imgPic. And I cant get it to work with getElementByName.

                      Regards, Tintin

                      J Offline
                      J Offline
                      JustForLive
                      wrote on last edited by
                      #13

                      if u set the html controls in the reapter,datalist etc.. the htmlcontrols or webcontrols will be add some words like "ctl00" before the html id

                      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