收录日期:2019/06/20 01:16:11 时间:2010-06-22 20:28:24 标签:c#,asp.net-mvc,design-patterns,oop

I have to make a web application that produces pages that contain panels with different setting configurations for different sites the page is hosted under.

For example, SiteA.com has a search panel with 3 select dropdowns and SiteB.com can have a search panel with 4 select dropdowns.

Can anyone offer any advice on how I could proceed? Or recommend any patterns that might conform to what I'm trying to achieve?

The concept of a panel is more ASP.NET and really shouldn't be used with ASP.NET MVC. You should use partial views to represent each search section that you need to display. So put all you custom code for each search section in a partial view then on your site you just call the partial to include that code:

<%Html.RenderPartial("SearchOne");%>

Code for SearchOne partial view, which looks like this:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<%Html.DropDownList("DropDownOne");%>
<%Html.DropDownList("DropDownTwo");%>
<%Html.DropDownList("DropDownThree");%>