I have to bind a Dropdownlist with coutries which should be grouped by region, I have found a sample code from the following link,
http://www.codeproject.com/KB/custom-controls/DropDownListOptionGroup.aspx?msg=3984074#xx3984074xx
I wanted the country list same as this. But problem is that I want to bind the dropdownlist from sql result. I have tried the following but didn't work,
ddlCountry.DataSource = CountryDtoCollection;
ddlCountry.DataBind();
ddlCountry.Attributes.Add("OptionGroup", "Region");
any one knows any solution for this.
you can write a custom server control and use the data source witch containing the text and region separated by | then split it when use.