Is there a way to group content within a Repeater with a dynamic heading?
For example, I have the following in a database:
- Tuesday – math
- Tuesday – science
- Friday – history
- Friday – art
I want it to be displayed in output on a web page as:
- Tuesday – math, science
- Friday – history, art
I want the items to be grouped by day; however, I do not want to create a new database connection for each day of the week, and I don’t want to hard code groups. Is there a way to group content by a database field?
Thank you in advance for your help.
You can use LINQ to modify the datasource that you’re binding to the repeater.
This should work:
EDIT
Here are some tutorials to get you started using LINQ: