2011-07-28 65 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