2011-07-28 159 views
0

我想在我的网站上自定义控件。asp.net在网站上自定义控件

以下是代码:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.ComponentModel; 
using System.Web.UI; 
using System.Web.UI.WebControls; 

namespace AnkitControls 
{ 
    /// <summary> 
    /// Summary description for CustomTreeView 
    /// </summary> 
    public class CustomTreeViewControl : WebControl 
    { 

    } 
} 

的Default.aspx:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" 
    CodeFile="Default.aspx.cs" Inherits="_Default" %> 
    <%@ Register Assembly="AnkitControls" Namespace="AnkitControls" TagPrefix="CustomCtrl" %> 
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> 
</asp:Content> 
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> 
    <h2> 
     Welcome to ASP.NET! 
    </h2> 
    <p> 
     To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>. 
    </p> 
    <p> 
     You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409" 
      title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>. 
    </p> 
</asp:Content> 

当我编译的网站,它给我的错误进行组装。

+0

哪些错误App_Code文件?询问时请提供所有相关信息,包括完整的异常消息和堆栈跟踪。顺便说一句,你没有问一个问题。 – driis

回答

1

它是比写Assembly=__code

如果DDL然后写DLL名称Assembly=dllname

+0

谢谢。我将代码放在App_Code中,无法使用程序集。 – Ankit