PDN-C6C7C8-PPT - Derived from System.Web.UI.Control. Create...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 6 Web Controls Detailed descriptions of server controls provided by FCL. Yingcai Xiao
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 7 User Controls Yingcai Xiao
Background image of page 2
Custom controls built from HTML and server-side scripts. Create your own tags and tag prefixes. File.ASCX User Controls
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Creation (Hello.ascx) <h1>Hello, world</h1> Usage (UserControlDemo.aspx) <%@ Register TagPrefix="Xiao" TagName="Hello" src="Hello.ascx" %> <html> <body> <form RunAt="server"> <Xiao:Hello RunAt="server" /> </form> </body> </html> TagPrefix="Xiao" defines a new tag prefix. TagName="Hello" defines a new tag using src="Hello.ascx". User Controls
Background image of page 4
Chapter 8 Custom Controls Yingcai Xiao
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Custom Controls Custom-built server controls using only a server-side language (no HTML).
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Derived from System.Web.UI.Control. Create your own tags and tag prefixes. Custom Controls Creation (Hello.cs) using System; using System.Web.UI; namespace WP { public class Hello : Control { protected override void Render (HtmlTextWriter writer) { writer.Write (&quot;Hello, world&quot;); } } } Note: the Render method is required to be overridden . Compilation: csc /target:library Hello.cs Move Hello.dll to bin of the virtual directory. Usage CustomControlDemo.aspx &lt;%@ Register TagPrefix=&quot;win&quot; Namespace=&quot;WP&quot; Assembly=&quot;Hello&quot; %&gt; &lt;html&gt; &lt;body&gt; &lt;form RunAt=&quot;server&quot;&gt; &lt;win:Hello RunAt=&quot;server&quot; /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; Custom Controls...
View Full Document

Page1 / 8

PDN-C6C7C8-PPT - Derived from System.Web.UI.Control. Create...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online