繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> ASP应用 >> Creating User Controls

Creating User Controls

2005-10-01 12:12:51  作者:masterall  来源:互联网  浏览次数:9  文字大小:【】【】【
简介:Creating User ControlsIn addition to the built-in server controls in the .NET Framework, you can also build your own controls to be placed on Web Forms. ASP.NET supports two different types of use...
关键字:Controls Creating User

Creating User Controls

In addition to the built-in server controls in the .NET Framework, you can

also build your own controls to be placed on Web Forms. ASP.NET supports

two different types of user-created controls: user controls and custom

controls. The creation of custom controls is beyond the scope of this book,

but it's simple to create user controls. These controls are basically saved

pages (or pagelets) that act as self-contained controls.

For example, you may wish to create a menu system along the left side of

every page in your site, where each menu item is built from a database. You

might also want to place a standard logo and header on each page. What you

need is some way to include standard pages, or parts of pages, within each

of your pages.

User controls provide this functionality and are the replacement for

#include files in ASP.NET. Figure 6.4 displays the output you might want to

generate. In this example, the image and header "Northwind Traders" are

both in one user control. The menu going down the left side is another

control.

Figure 6.4. User controls output HTML on the client side.

Figure 6.5 shows the same Web page in design mode. As you can see, these

user controls are simply placeholders. You can see the full UI for such

controls by opening the file where you built them within your project.

Figure 6.5. User controls do not display any HTML on the server side; they

are just placeholders.

责任编辑:admin
相关文章