0

Error: Reference to type 'IHtmlString' claims it is defined in 'System.Web', but it could not be found

I am trying to display some data from database into a grid and doing sorting & pagging on that grid. Rather than creating sorting & pagging manually, i found about WebGrid or GridView(old framework). I need similar grid that I can use for new .net6+

I am using visual studio 2022, asp.net core web app and .net 6 version.

i searched on google but said to either use older version of .net framework or use asp.net core MVC or adding reference inside system file

I dont want to use older version of .net or visual studio. I am not using MVC. I only have program.cs file in my project not system

ref link

@using System.Web.Helpers;
@{
    var webGrid = new WebGrid(Model.ShapesList);
    @webGrid.GetHtml()
}

i downloaded following nugets:

Microsoft.AspNet.WebPages
Microsoft.AspNet.Mvc
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlSe
Microsoft.EntityFrameworkCore.Tool
dave
  • 162
  • 8
  • There's something wrong with your project file, like referencing an asp.net 2 package, or something corrupt in your working folder. – Jeremy Lakeman Jan 11 '23 at 03:25
  • Does this answer your question? [Reference to type 'IHtmlString' claims it is defined in 'System.Web', but it could not be found](https://stackoverflow.com/questions/69510418/) – Dour High Arch Jan 11 '23 at 03:28
  • no, sorry. `.NET Framework` version is like 10 years old version. I am trying to keep .net 6+ – dave Jan 11 '23 at 03:31
  • Microsoft.AspNet.WebPages is for .net 4.5 not for .net 6. What are you trying to achieve? – Jeremy Lakeman Jan 11 '23 at 04:41
  • Refer to this [link](https://stackoverflow.com/questions/40912473/can-system-web-be-used-with-asp-net-core-with-full-framework), I don't think you can use `System.Web` in asp.net core, You need to find a method with similar functionality in .Net Core. – Xinran Shen Jan 11 '23 at 06:20
  • You are confusing the (really old) ASP.NET Web Pages framework with ASP.NET Core Razor Pages. You cannot use the WebGrid helper in ASP.NET Core. – Mike Brind Jan 11 '23 at 10:37
  • awh ok that answer my question. I didnt knew WebGrid is for old framework only. Is there a WebGrid alternative for `.net 6+` or no? – dave Jan 11 '23 at 14:25
  • @JeremyLakeman I just need a grid for .net 6+ so I dont have to manually create html table and track all sorting & pagging – dave Jan 11 '23 at 14:58
  • 1
    There is nothing built into .NET 6 for that. You'll need to look for a third party solution. – Mike Brind Jan 11 '23 at 16:26
  • sound good. that answer my question. Ill just build my own – dave Jan 11 '23 at 18:43

0 Answers0