Saturday, July 21, 2007

Web User Control: Basics Register Directive

A web user control is similar to a complete web forms page
It has GUI as well as a code-behind
Extension of a user control is ascx
User control doesnt have html,body and form tags, hosting page should provide these
To use a web user control, drag and drop the ascx file onto a webform in design mode
Dropping user control on the page causes following:
a. A new @Register directive gets added:
<@ Register src = “ControlName.ascx” TagName=”ControlName” TagPrefix=”uc1”>

b. Element for the user control:
uc1:ControlName id=”ControlName1” Runat=”Server”

No comments: