More of an asp.net question than a commerce server specific one, but here goes.

In the starter site, on Browse.aspx, the CommerceSite.Controls namespace is declared at the beginning of the page and the ProductList.ascx control is registered immediately after.

This let's you drop a <site:ProductList> user control in to display products whose data comes from ProductFilterDataSource.

I've got the need to dynamically create ProductList user controls (quantity from 1-n) depending on the category and I need to do it from code behind.

I'm having problems registering and namespace and user ProductList user control properly so that my Browse.aspx.cs code behind file can utilize it.

Clear as mud Thanks for any suggestions.


Re: Commerce Server 2007 Browse.aspx and ProductList.ascx

Joe Wasson - MSFT

This post might answer your question:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=91274&SiteID=1

Basically, UserControls (.ascx) are compiled in a different way so you can't just access them like you would a server control built in the App_Code directory.

Re: Commerce Server 2007 Browse.aspx and ProductList.ascx


Hi Joe,

Thanks for the info... that post led me to others and I've got a much better understanding of .ascx files now.

As for anyone else that is curious, I am able to dynamically create the controls using something like:

ProductList productList = (ProductList)Page.LoadControl("Controls/ProductList.ascx");