DDL Creation
-
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
-
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
-
DropDownList1_OnSelectedIndexChange { DropDownList2.Visible = true; } Crude I know, but it works ;)
-
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?
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|
-
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|
-
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
-
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.
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?