ASP.NET'GridView'不包含'VirtualItemCount'的定义

时间:2022-01-13 16:52:59

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

我试图在ASP.NET Web窗体GridView中使用属性VirtualItemCount进行自定义分页,它给了我这个错误

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

它看起来像这样

ASP.NET'GridView'不包含'VirtualItemCount'的定义

These are my settings

这些是我的设置

ASP.NET'GridView'不包含'VirtualItemCount'的定义

ASP.NET'GridView'不包含'VirtualItemCount'的定义

ASP.NET'GridView'不包含'VirtualItemCount'的定义

1 个解决方案

#1


0  

I just go to Properties -> Application and change Target Framework from .NET Framework 4 to .NET Framework 4.5 and it's works

我只是转到属性 - >应用程序并将目标框架从.NET Framework 4更改为.NET Framework 4.5,它的工作原理

#1


0  

I just go to Properties -> Application and change Target Framework from .NET Framework 4 to .NET Framework 4.5 and it's works

我只是转到属性 - >应用程序并将目标框架从.NET Framework 4更改为.NET Framework 4.5,它的工作原理