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. General Programming
  3. C#
  4. doubt in javascript

doubt in javascript

Scheduled Pinned Locked Moved C#
javascriptwpfwcfhelp
7 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.
  • I Offline
    I Offline
    imsathy
    wrote on last edited by
    #1

    im using a js function to dynamically fill a dropdown. im using document.getElementById('dd') for getting the id of the select box. first it was working properly and now not. document.getElementById('dd') retuning a null and previosly it was returning a object. so im not getting the binding. what could be the problem :( sathy

    G 1 Reply Last reply
    0
    • I imsathy

      im using a js function to dynamically fill a dropdown. im using document.getElementById('dd') for getting the id of the select box. first it was working properly and now not. document.getElementById('dd') retuning a null and previosly it was returning a object. so im not getting the binding. what could be the problem :( sathy

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Have you checked the source of the page? What id does the dropdown get? If you moved the dropdown inside a container, the id can change. --- b { font-weight: normal; }

      I 1 Reply Last reply
      0
      • G Guffa

        Have you checked the source of the page? What id does the dropdown get? If you moved the dropdown inside a container, the id can change. --- b { font-weight: normal; }

        I Offline
        I Offline
        imsathy
        wrote on last edited by
        #3

        thanx a lot Guffa

        Guffa wrote:

        Have you checked the source of the page? What id does the dropdown get?

        the id for the select tag is 'dd' only ...

        Guffa wrote:

        If you moved the dropdown inside a container, the id can change.

        i cant get this above point:doh: ??? i dunno why im gettin that null:omg:... sathy

        G 1 Reply Last reply
        0
        • I imsathy

          thanx a lot Guffa

          Guffa wrote:

          Have you checked the source of the page? What id does the dropdown get?

          the id for the select tag is 'dd' only ...

          Guffa wrote:

          If you moved the dropdown inside a container, the id can change.

          i cant get this above point:doh: ??? i dunno why im gettin that null:omg:... sathy

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Well, if the id in the tag is correct, then there has to be something else in your code that causes the problem. Do you have any other element with the same id?

          imsathy wrote:

          i cant get this above point ???

          If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42". --- b { font-weight: normal; }

          I 1 Reply Last reply
          0
          • G Guffa

            Well, if the id in the tag is correct, then there has to be something else in your code that causes the problem. Do you have any other element with the same id?

            imsathy wrote:

            i cant get this above point ???

            If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42". --- b { font-weight: normal; }

            I Offline
            I Offline
            imsathy
            wrote on last edited by
            #5

            Guffa wrote:

            If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42".

            thanx for the explanation. but im using the select tag on the same page.

            Guffa wrote:

            Do you have any other element with the same id?

            i tried keeping some unique name. but null is wat it returns if check tat wit a alert. but my previous similar coding in the source gear is workin perfectly sathy

            G 1 Reply Last reply
            0
            • I imsathy

              Guffa wrote:

              If you put the dropdown in a user control, for an example, with the id "froglegs", the dropdown would get the id "froglegs_dd". If you put the dropdown in a repeater, each dropdown created would get a unique id, like "Ctrl_42".

              thanx for the explanation. but im using the select tag on the same page.

              Guffa wrote:

              Do you have any other element with the same id?

              i tried keeping some unique name. but null is wat it returns if check tat wit a alert. but my previous similar coding in the source gear is workin perfectly sathy

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              Test by giving the element a different id, just to see if that makes the javascript work. Also check for other errors in the page source. For an example, if the element is placed outside the form, it might be ignored by the browser. --- b { font-weight: normal; }

              I 1 Reply Last reply
              0
              • G Guffa

                Test by giving the element a different id, just to see if that makes the javascript work. Also check for other errors in the page source. For an example, if the element is placed outside the form, it might be ignored by the browser. --- b { font-weight: normal; }

                I Offline
                I Offline
                imsathy
                wrote on last edited by
                #7

                thanx a lot Guffa..... the error was bcoz i was callin the function inside the script and not on the onload event of the page :)..... sathy

                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