Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# D3grade 4/20/2008 3:04 PM
Hi Guys,

I don't know if anyone else comes across this problem but i've hit it a number of times.

The problem i have is that i will produce a module that works one way and the code behind file will have certain rules to show and hide buttons etc. Then when it comes to using it on another project, the requirements on how it works might change. As we are not wanting to create new modules everytime, i'm trying to think of a way to do create different views for a module, without changing the core logic beind it.

One thing to note is that they way we use the cms at the moment is to have one central version and for a new site we will compile it all and just export the web folder so we just get the .asmx and .aspx files and all the logic is compiled into dlls.

Inspired by the MVC framwork i was wondering what we could do to create different self rendering views for the same module. In it's simplest form is could be giving the .asmx and .aspx files a public property with access to the main data for that module and embeding the view logic inline inside the .asmx and .aspx files themselves. Or another thing i've been thinking about is to get the modules themselves to just render XML and allow the admin to choose an XSLT file as to how this gets converted to HTML.

I'd like to get some peoples view on this, firstly on weather the way we are working is how most others are? and weather any of the 2 ideas would be a good one?

Many thanks

Matt
# YKS 4/21/2008 11:39 AM
You can swicth the current user control override this functions into your ModuleBase:



protected override void ParsePathInfo()

public override string CurrentViewControlPath

# D3grade 4/21/2008 1:20 PM
But what about if you want to use the same module on the same site in different locations, but have different views?
# YKS 4/22/2008 6:49 PM
You can select view from section setting using a enum like this:



public enum render_type
{

}


public override string CurrentViewControlPath
{
get
{

//DisplayMode -> enum render_type
return DefaultViewControlPath.Substring(0, DefaultViewControlPath.LastIndexOf("/") + 1) + _displayMode + ".ascx";

}
}
# D3grade 4/22/2008 8:11 PM
This is kinda what we have done at the moment actually, the only negative i have about it is that you can't currently control which items appear in the list (ie if your module has quite a few view by default), but i guess you could implement some sort of interface and only show controls that implement it.

I think it might be a good idea that i don't compile the web project and allow the code behind files for the controls to be edited as part of the implementation.

Thanks for you help YKS.

I'd still like to hear other peoples view on this though if they would like to get invlolved.

Matt