0

I'm working with ASP.NET. I want to make optgroups in a DropDownList using data binding to data from SQL Server. For example, I've got 2 tables — one for country & another for states. In my drop down list in ASP.NET, I want to bind to the data in these 2 tables. The country table should become optgroup, & states should go under that.

-India-
  kerala
  tamilnadu
-america-
  newyork

1 Answer 1

2

Actually you can solve this with a hack. Override RenderContents of the DropDownlist like this http://weblogs.asp.net/jeff/archive/2006/12/27/dropdownlist-with-optgroup.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.