2013-01-08 56 views
0

我想延長ListView控制:找不到ASP.net ListView控件

using System; 
using System.Data; 
using System.Collections; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.ComponentModel; 
using System.Resources; 
using System.ComponentModel.Design; 
using System.Globalization; 

namespace My.WebControls 
{ 
    /// <summary> 
    /// my ListView 
    /// </summary> 
    [Designer(typeof(System.Web.UI.Design.WebControls.DataBoundControlDesigner))] 
    public class MyListView : ListView 
    { 
    } 
} 

但是編譯器沒有發現這種控制。我包括命名空間system.web.ui.webcontrols。我需要檢查其他東西嗎?我使用框架3.5。

+0

你試過繼承'Controls'類嗎? –

+0

可以找到'Control'類以及'Datagrid'和其他控件。 – anmarti

+0

我覺得它的visual studio IDE的問題。嘗試清理並重建您的解決方案,如果不行的話重啓機器。 – Dev

回答

4

ListView文檔can be found on MSDN,你可以看到,控制在System.Web.Extensions.dll

存在

enter image description here

重新檢查,如果你有這樣的裝配在你的引用。

這裏的工作MyList

[System.ComponentModel.Designer(typeof(System.Web.UI.Design.WebControls.DataBoundControlDesigner))] 
public class MyCustomListView : System.Web.UI.WebControls.ListView 
{ 
    // ... 
} 

因爲DataBoundControlDesigner我也不得不引用System.Design.dll,驗證,如果你也有這樣的參考的完整的命名空間。

+0

我忘了引用程序集。 – anmarti

+0

你是怎麼畫這個紅色箭頭的? – anmarti

+0

我用鼠標;)...開玩笑:http://www.techsmith.com/download/jing/default.asp – balexandre