Yes,I want to create the UserControl insert into Web Page. I study following Example:
using System;
using System.Web;
using System.Web.UI;
NameSpace MyFirstCustomerControl{
public class HelloWord:WebControl
{
protected override void Render(HtmlTextWriter output)
{
output.WriteLine("Hello World");
output.WriteLine("The time is now:"+DataTime.Now.ToString());
}
}
}
Save as HelloWorld.cs file. Then compile it:
csc /t:Library /out:HelloWorld.dll /r:System.DLL /r:System.Web.DLL HelloWorld.cs
Now create a Web Page:
<%@ Page Language="C#" %>
<%@ Register TagPrefix="ACME" NameSpace="MyFirstCustomControl" Assembly="HelloWorld" %>
<html><body>
<ACME:HelloWorld id="helloworld1" runat="server"/>
</body></html>
It work well! The difference is I make an ActiveX control into DLL Compnent. Do you understand? Thanks!