The previous article writes a component that is dynamically loaded user components.
But how is it flexible in the project? How to develop components? Just like building a building, our leaves can have different components to do, and the entire foliage is a container. We are just to add different elements to the container, so as long as our elements can be universal, Generally, the elements have accumulated to a certain level, and the elements can be rich enough to construct we want the leaves.
Use more to the next article to come in detail. Let's take a look at how to load the combination of our user components:
1. Let's make two elements first, here I will call the user component ASCX file as an element. Head.ascx and footer.ascx.
2, make an ASPX foliar to load two elements.
3. The effect of operation is as follows:
Haha! Is it very exciting?
It's so moving to dynamically load it, let the heads change your position! We add a button on the Aspx leaf and change the load different user components in the corresponding event of the button. The code is written like this:
After running:
Try it with the mouse
Aha! Is it the position of the head?
it is good! Dynamically load user components get it. Can be released.
Then this is just a simple application, let us look forward to the next article to come to experience the real application of dynamically loaded formation.
Sitting on the sofa, etc. ...
Last (continued)