增加用户控件或自定义控件

1. 确保页面上用 Register 指令注册此用户控件或自定义控件

<@ Register tagPrefix=”my” tagName=”mycontrol01” src=”~/UserControls/mycontrol.ascx” >

2. 或者确保 web.config 中注册了此用户控件或自定义控件

<pages>
   <controls>
      <add tagPrefix="my" namespace="My.MyControls" assembly="My.MyControls" >
      <add tagPrefix=”my” tagName=”mycontrol01” src=”~/UserControls/mycontrol01.ascx”  >
   </controls>
  </pages>

3. 确保 Register 指令与控件声明的拼写完全正确,下例是 1 和 L 的误写导致的错误

<@ Register tagPrefix=”my” tagName=”mycontrol01” src=”~/UserControls/mycontrol.ascx” >

<my:mycontrol0lrunat=”server” />

posted @ 2011-10-31 16:36  Randolph Liu  阅读(146)  评论(0编辑  收藏  举报