Lessons in this course (9)

1. User controls vs custom server controls

Basic★ Must knowLesson 1 of 9
User control (.ascx)Custom server control (class)
Built withMarkup + code-behind (designer support)Code only (C#/VB), renders its own HTML
ReuseWithin one web application (needs the .ascx file)Across applications (compiled DLL), Toolbox support
EffortLowHigher
Design-timeBasicRich (designers, smart tags, property grid)
Registration<%@ Register Src="~/Controls/X.ascx" TagPrefix="uc" TagName="X" %><%@ Register Assembly="Shop.Controls" Namespace="Shop.Controls" TagPrefix="shop" %> or web.config <controls>
ExampleAddress editor, login box for this siteReusable <shop:Money> label, rating control sold to many projects

User controls were covered in the Web Forms course; here we build custom controls.