ASP.NET Runtime arrange my controls
I want to build a website where i can define the location of my usercontrols. For example i create a Masterpage layout with three columns (very simple). I have 5 us开发者_运维知识库ercontrols eg. "Search", "Recent News", "Recent Blogs", "Top 10 something", "Login"
On this site i would like to in "runtime" to define which columns each usercontrol should belong to and in which order (eg. search on top, then top 10 below - in the left column).
How do i provide this to the "administrator" of the site? Do I use placeholders? and how do I rearrange them without editing the physical files on disc?
Was thinking of having some sort of sorting order in my database - but this doesnt seem like the cleanest way...
Just cant wrap my brain around this
/Brian
Classic ASP.NET has a more-or-less built-in feature called WebParts:
A web part is an ASP.NET server control which is added to a Web Part Zone on Web Part Pages by users at run time. Web Parts are an integrated set of controls for creating Web sites that enable end users to modify the content, appearance, and behavior of Web pages directly from a browser. The Web Parts control set is a group of components that work together to enable developers to create Web pages where users can modify the user interface (UI) directly from a browser. The UI controls all derive from the Part class, and they compose the primary UI on a Web Parts page.
This can be done using web parts and having zones. It links in with the membership provider and the position of these components can be saved.
I have used this on a few projects, its quite a nice .net feature.
There are so called WebParts in ASP.Net that deliver exactly what you are looking for. But this is not some boolean switch that you can just activate.
You have to include that in your planning and design of your web application.
精彩评论