get all the drop down list id and value from place holder c#


            // Retrieve the selected product options
            string options = "";
            foreach (Control cnt in Place.Controls)
            {
                /*
                if (cnt is Label)
                {
                    Label attrLabel = (Label)cnt;
                    options += attrLabel.Text;
                }
                */
                if (cnt is DropDownList)
                {
                    DropDownList attrDropDown = (DropDownList)cnt;
                    options += attrDropDown.Items[attrDropDown.SelectedIndex] + ";";
                }
            }

place is the place holder name. and put them a string

Comments

Popular posts from this blog

like php