看了微軟網站上面的簡單自定義控件的源代碼,可是做了半天也不出來.請問做自定義控件的步驟是?最好說詳細一些
下面是代碼:
Simple.aspx
<%@ Register TagPrefix="SimpleControlSamples" Namespace="SimpleControlSamples" Assembly="SimpleControlSamples" %>
<html>
    <body>
      <form method="POST" action="Simple.aspx" runat=server>
          <SimpleControlSamples:Simple id="MyControl" runat=server/>
      </form>
   </body>
</html>
Simple.cs
using System;
using System.Web;
using System.Web.UI;namespace SimpleControlSamples {    public class Simple : Control {       protected override void Render(HtmlTextWriter output) {
           output.Write("<H2>欢迎使用控件开发!</H2>");
       }
    }    
}
希望高手指點,謝謝~!

解决方案 »

  1.   

    你编译了吗,应该先编译,放在\bin目录下http://support.apress.com/code_listing.asp?s=0&view=all中有关于控件开发的例子,可以下载代码研究
      

  2.   

    页面中,下面就是Professional ASP.NET Server Controls - Building Custom Controls with C#--5644.zip
    Download source code for this book (646KB) 
    --5644_javascriptchapter.pdf
    Download free extra chapter on creating controls that render JavaScript! (604Kb) 
    --5644_javascriptcode.zip
    Download source code to accompany free chapter (150Kb) 
      

  3.   

    下載不下來,:(,我這不能用flashget下
      

  4.   

    不用下載了,msdn上有很多你可以參考看看.