您的位置:首页 > 移动开发

User controls and custom controls

2005-03-24 02:20 330 查看
User controls are easy to make, but they can be less convenient to use in advanced scenatios. You can develop user controls almost exactly the same way that you develop web forms pages. Like Web Forms, user controls can be created in the visual designer, they can be written with code separated from the HTML, and they can handle execution events.
However, because user controls are compiled gynamically at run time, they cannot be added to the Toolbox, and they are presented by a simple placeholder when it is added to a page. This makes user controls harder to use if youu are accustomed to full Visual Studio.NET design-time support, including the properties window and Designview previews. Also, the only wat to share the user control between applications is to put a seperate copy in each application, which takes more maintenance if you make changes to the control.
Custom controls are compiled code, which makes them easier to use but more difficult to create; customer controls must be authored in code. Once you have created the control, however, you can add it to the Toolbox and display it in a visual designer with full properties window support and all the other design-time feature of ASP.NET server controls.
In addition, you can install a single copt of the custom control in the global assembly cache and share it between applications, which makes maintenance easier.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息