Problem with dropdownlist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • looserash
    New Member
    • Mar 2008
    • 8

    Problem with dropdownlist

    hi,

    I am new to this web site please help me with the bug i am getting. Here i have populated dropdownlist. i have to fill a particular item in ddl that is stored in sql 2000 database
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Originally posted by looserash
    hi,

    I am new to this web site please help me with the bug i am getting. Here i have populated dropdownlist. i have to fill a particular item in ddl that is stored in sql 2000 database
    Is this a problem with TSDN?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by looserash
      hi,

      I am new to this web site please help me with the bug i am getting. Here i have populated dropdownlist. i have to fill a particular item in ddl that is stored in sql 2000 database
      Which language?

      Moved to the Misc. forum in the meantime.

      Comment

      • looserash
        New Member
        • Mar 2008
        • 8

        #4
        hi,

        actually here when i want to update my dropdownlist each time i have to select the item in dropdownlist otherwise it ll give an error if not selected. so can i write the code in c# even if i dont select it has to store null value in database and run without any error. help me with this. thanks

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          This will then be best answered in the .NET forum. Moved to .NET.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by looserash
            hi,

            actually here when i want to update my dropdownlist each time i have to select the item in dropdownlist otherwise it ll give an error if not selected. so can i write the code in c# even if i dont select it has to store null value in database and run without any error. help me with this. thanks
            Set your DropDownList to AutoPostback... then you can check on the server if the value they've selected is invalid.

            I'm not clear on what the problem is, could you please elaborate on what your program is supposed to do?

            -Frinny

            Comment

            • looserash
              New Member
              • Mar 2008
              • 8

              #7
              hi,

              i have set it to auto postback.. here m able to place the item in the dropdownlist from the database during update event.my problem is here i want to select the dropdownlist each time if i don select it throws an error.. but i want it to update even if i don select the item in dropdownlist. please help me with this.

              thank you.

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #8
                Originally posted by looserash
                hi,

                i have set it to auto postback.. here m able to place the item in the dropdownlist from the database during update event.my problem is here i want to select the dropdownlist each time if i don select it throws an error.. but i want it to update even if i don select the item in dropdownlist. please help me with this.

                thank you.
                Please post your code for populating (adding items to) your DropDownList.
                I'm not sure if you're trying to programatically set the selected value, or if you are talking about letting the user select a value.

                Are you trying to remember the value that the user selected?
                Then after adding new values, resetting the selected value?

                I still don't understand what you are trying to do.

                To set the selected item programatically :
                [code=vbnet]
                'If you only know the value that should be selected:
                myDropDownList. Items.FindByVal ue("the value that should be selected").Sele cted = True
                'If you know the index that should be selected:
                myDropDownList. Items(0).Select ed = True
                '....
                [/code]

                You should probably also post the code for your AutoPostBack event (the Selected Index Changed event)

                -Frinny

                Comment

                Working...