简体   繁体   中英

ASP.NET 'GridView' does not contain a definition for 'VirtualItemCount'

I'm trying to use property VirtualItemCount for custom paging in ASP.NET web Forms GridView, it gives me this error

Severity    Code    Description Project File    Line    Suppression State
Error   CS1061  'GridView' does not contain a definition for 'VirtualItemCount' and no extension method 'VirtualItemCount' accepting a first argument of type 'GridView' could be found (are you missing a using directive or an assembly reference?)   dms D:\project\Screen\ToDoList.aspx.cs  100 Active

when I create new project its works fine but in my current project it appear like its not defined , I search a lot with no case similar to mine.

Do I need to add certain assembly reference or missing settings?

<asp:GridView ID="GridView1" runat="server" CssClass="Grid"
    PageSize="10" 
    AllowPaging="true"
    AutoGenerateColumns="false" OnPageIndexChanging="GridView1_PageIndexChanging">
    <AlternatingRowStyle />
    <Columns>
        <asp:BoundField DataField="Name" HeaderText="Name" />
        <asp:BoundField DataField="Date" HeaderText="Date" />
        <asp:TemplateField>
            <ItemTemplate>
                <input type="button" value="Edit" class="button" />
                <input type="button" value="delete" class="button" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

It appears like this

在此处输入图片说明

These are my settings

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

我只需转到“ Properties -> Application然后将Target Framework.NET Framework 4更改为.NET Framework 4.5 ,即可使用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM