[ASP. NET] How to flexibly customize skin/Page: Layout designer Introduction

Source: Internet
Author: User
I have read some of the source code of dotnetnuke 4 (dnn) in the past. As a CMS, its implementation is undoubtedly worth learning. I personally pay more attention to the page presentation, so I pay special attention to the skin replacement, layout, and other parts. Although dnn is already excellent in this aspect, I think there are still some improvements, this is also the main content of this article: Layout designer!

So what is worse about dnn in terms of skin/layout? That is,Users cannot easily add new skins! To add a new skin, only web developers/designers can add new user controls (. ascx, which is the implementation mechanism of dnn skin) and copies the relevant image files to the portals \ * \ skins directory. If the site does not provide the relevant upload function, this work can only be performed by the Administrator. It is particularly inconvenient to modify and may need to be uploaded again. Isn't it perfect to modify the layout and content of the skin online ?!

To achieve the above purpose, the ascx form of dnn that achieves "static" skin is obviously not desirable! As we all know, dnn pages are formed by dragging the module to the specified skin, so we imitate this method, that is, the skin is formed by dragging the module to a blank page, this blank page has been split by the layout designer into a specific layout, such as the Standard Layout of "three rows, three columns in the middle" defined in dnn (I do not know how to describe it, can anyone understand this? I'm poor at writing skills !), Of course, one or more blank areas should be set aside in the skin for specific pages to place their respective content.

If you understand the preceding description, you can drag and drop modules in each area to create a skin. For example, we divide the page into three rows and place an HTML module in the first and last rows. (Should anyone who has read dnn know the role of this module ?!), Edit the HTML module of the first line to form a page header, and edit the HTML module of the last line to form a footer, there is a blank area in the middle of the skin to form!

Currently, I have encapsulated the layout editor into a server-side control and used the callback feature introduced by ASP. NET 2.0 to achieve Ajax-like effect. The demo is as follows:

Combined with the layout designer and ASP. net webpart framework, I made a basic example to prove its feasibility. The following is a simple split into two columns (Hey, it seems ugly, after all, I am not an artist, without any processing ):

P.s. The above are the results of my study, which may be used for corporate projects and do not provide source code download. However, the implementation is not complicated. I can do it all, so it is easy to see ~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.