How to Create a Property Which will contain a Dropdown?
-
Dear Concerned, I want to create a property in my user control which i am creating in Web Control Library. I am using .Net 2003. My question is that how I can create a property that will contain a dropdown list & will have five values 1,2,3,4,5. The Programmer will be able to select one of these values at design time in his aspx page. Please help in the form of code. Thanks, Fasih
fasih_is_my_signature
-
Dear Concerned, I want to create a property in my user control which i am creating in Web Control Library. I am using .Net 2003. My question is that how I can create a property that will contain a dropdown list & will have five values 1,2,3,4,5. The Programmer will be able to select one of these values at design time in his aspx page. Please help in the form of code. Thanks, Fasih
fasih_is_my_signature
Not sure what exactly you are looking for, but it sounds like you need to know how to populate a drop down list. ddl.Items.Insert(0, "--Select--"); ddl.Items.Insert(1, "Value 1 or whatever"); This is how you hard code the values to be displayed, if you want to load 'em dynamically, then use a dataset or something as a datasourse for this drop down list. Look at the code below: ddl.DataSource = ds; ddl.DataTextField = "Columns_Name"; ddl.DataValueField = "Column_Name"; // note this won't be diaplayed ddl.DataBind(); *NOTE : ddl = drop down list Hope this helps. sam Eating, drinking and coding...you can't have it better than that!!