Click here to Skip to main content
12,890,211 members (43,547 online)
Rate this:
Please Sign up or sign in to vote.
I want to create a dynamic checkbox based on selected value text from drop-downlist.

For example: The dropdownlist will have:

(test1, test2, test3) so if I am
selecting Test2
it will create a check box called test2 and so dynamically check box will get created.

this created check box will have side by 1 more linked button with few other details. and In the selected drop down list will more 5k records so whichever record wanted only will create a checkbox and go further functionalities
Posted 5-Sep-12 21:15pm
Dynamic check box? Do you mean there is such thing as "static check box"? :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hey based on your requirement you can change the below code

Drop a Place holder where u want the checkbox to appear ,

Set Autopostback property of dropdown =true

and then add the below code (for sample only) to you selectedindex changed event

protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
     CheckBox chk = new CheckBox();
     chk.Checked = false;
     chk.Text = DropDownList2.SelectedItem.Text;
Tech_bee 6-Sep-12 4:07am
Thanks a lot...if i select another item in dropdownlist it should create another checkbox.

Like : Test1 Selected in Dropdown checkbox will create called Test1
Test2 Selected in Dropdown checkbox will create called Test2 newly get added in the palceholder. New check box on each selection of dropdown.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 6 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100