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. DDL Creation

DDL Creation

Scheduled Pinned Locked Moved C#
helpcsharptutorialquestion
7 Posts 3 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.
  • K Offline
    K Offline
    kontax
    wrote on last edited by
    #1

    hi, i'm posting 'cause i have a problem i can't manage to solve... i have a page with a row of DropDownLists, and what i want to do is this: when the user selects a value from one of the dropdowns , a new one is created under the selected, with the same values of the previous one, except for the selected one. i know i have to write a function in c# called from OnSelectedIndexChange, but i can't understand how to create the new ddl from the code.. can anyone one help me or suggest a better way to do that? thanks anyway, and sorry for the poor english.. bye Kontax

    R 1 Reply Last reply
    0
    • K kontax

      hi, i'm posting 'cause i have a problem i can't manage to solve... i have a page with a row of DropDownLists, and what i want to do is this: when the user selects a value from one of the dropdowns , a new one is created under the selected, with the same values of the previous one, except for the selected one. i know i have to write a function in c# called from OnSelectedIndexChange, but i can't understand how to create the new ddl from the code.. can anyone one help me or suggest a better way to do that? thanks anyway, and sorry for the poor english.. bye Kontax

      R Offline
      R Offline
      Reelix
      wrote on last edited by
      #2

      DropDownList1_OnSelectedIndexChange { DropDownList2.Visible = true; } Crude I know, but it works ;)

      K 1 Reply Last reply
      0
      • R Reelix

        DropDownList1_OnSelectedIndexChange { DropDownList2.Visible = true; } Crude I know, but it works ;)

        K Offline
        K Offline
        kontax
        wrote on last edited by
        #3

        thanks anyway, but i think i explaned it in a wrong way... :sigh: i dont know previously the number of DDL the user needs, so i cant create them before. suggestions?

        R 1 Reply Last reply
        0
        • K kontax

          thanks anyway, but i think i explaned it in a wrong way... :sigh: i dont know previously the number of DDL the user needs, so i cant create them before. suggestions?

          R Offline
          R Offline
          Reelix
          wrote on last edited by
          #4

          private System.Windows.Forms.ListBox listBox1; private void button1_Click(object sender, EventArgs e) { this.listBox1 = new System.Windows.Forms.ListBox(); this.SuspendLayout(); this.listBox1.Location = new System.Drawing.Point(0, 0); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(50, 50); this.listBox1.Items.Add("Testing"); this.listBox1.SelectedIndexChanged += new System.EventHandler(this.l1_SelectedIndexChanged); this.Controls.Add(listBox1); this.ResumeLayout(); } private void l1_SelectedIndexChanged(object sender, EventArgs e) { MessageBox.Show("It Works!"); } Im not proud of it, but it works... :sigh: Might need some heavy modification... X|

          K 1 Reply Last reply
          0
          • R Reelix

            private System.Windows.Forms.ListBox listBox1; private void button1_Click(object sender, EventArgs e) { this.listBox1 = new System.Windows.Forms.ListBox(); this.SuspendLayout(); this.listBox1.Location = new System.Drawing.Point(0, 0); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(50, 50); this.listBox1.Items.Add("Testing"); this.listBox1.SelectedIndexChanged += new System.EventHandler(this.l1_SelectedIndexChanged); this.Controls.Add(listBox1); this.ResumeLayout(); } private void l1_SelectedIndexChanged(object sender, EventArgs e) { MessageBox.Show("It Works!"); } Im not proud of it, but it works... :sigh: Might need some heavy modification... X|

            K Offline
            K Offline
            kontax
            wrote on last edited by
            #5

            Thanks for the answer, it's just some days i'm working with c# so i can't understand what you wrote, anyway thank you another time, i'll try to understand and use it! byee

            D 1 Reply Last reply
            0
            • K kontax

              Thanks for the answer, it's just some days i'm working with c# so i can't understand what you wrote, anyway thank you another time, i'll try to understand and use it! byee

              D Offline
              D Offline
              darkelv
              wrote on last edited by
              #6

              Well, you didn't know how many ddl you will need so you can't create them in design time. What he showed you is that you can dynamically create them once you know that you need a ddl, during the post back.

              K 1 Reply Last reply
              0
              • D darkelv

                Well, you didn't know how many ddl you will need so you can't create them in design time. What he showed you is that you can dynamically create them once you know that you need a ddl, during the post back.

                K Offline
                K Offline
                kontax
                wrote on last edited by
                #7

                hi.. I can't manage to work with that code... It says that i need the System.Windows.Forms namespace. But if i include it with "using" it doesn't works, cause he can't find the system.windows namespace. i tried to download System.Windows.Forms.dll and put it in C:\windows\assembly but nothing changed..suggestions?how can i include it?

                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