Search code examples
.netasp.netdata-bindingsubsonicmaster-detail

Best way of expressing Master-Detail in this way?


I have master-detail relationship. Basically I have a list of states and a list of towns per state.

I want for it to display something like

  • Oklahoma
  • Tulsa

  • Oklahoma City

  • Arizona
  • Phoenix

  • etc etc

and etc.

The city names and the state names are stored in different tables with each city containing a state_id

I am using SubSonic3(ActiveRecord) for querying. (using ObjectDataSource for databinding controls)

What would be the best way to do this in an ASP.Net page? The only ideas I can think of involve complicated nested databinding which I can't get to work.


Solution

  • Not sure how much at ease you will be with the following suggestions:

    Using repeaters for displaying nested data: http://www.asp.net/data-access/tutorials/nested-data-web-controls-vb

    Working with nested data: http://msdn.microsoft.com/en-us/library/aa478959.aspx

    If you are to only display nested data and not edit/update it, repeaters might be good choice.

    You could then use ul li tags for the layout of your choice.

    Hope it helps!