The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely. User Control V's Class


I've recently built a new breadcrumb control using an .ascx user control. It consists of a third party menu control and some other html elements. The menu control accepts a DataSource and so when I include the user control in a page, I set a property that in turn binds to the menu in the user control. I had to do this programmatically as the DataSource is a dynamic collection. So to include my user control I add the following code to each page that requires the breadcrumb:

            //breadcrumb user control
            Control cBreadCrumb = Page.LoadControl("Header/PortfolioBreadcrumb.ascx");
            ((PortfolioBreadcrumb)cBreadCrumb).DataSource = Catalog.NavigationList;

I'm now wondering whether an .ascx is the best way to implement this. So I thought maybe create a new class called BreadCrumb and within it have a DataSource property and a method called Build that returns the Menu bound to the DataSource. So to now include the Menu alone, not including the other html elements that exist in the .ascx control I use the following code:

            BreadCrumb bc = new BreadCrumb();
            bc.DataSource = CartObject.Catalog.NavigationList;           

What is the best approach, is there a right or wrong answer to this?

Or is there another way?

Many Thanks
Monday, January 23, 2006
Dynamic, databound components are best implemented as a custom control (i.e., a class derived from System.Web.UI.Control).
Mark Cidade Send private email
Monday, January 23, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz