I created a new ASP.NET Core with controllers and views in Visual Studio 2019.
I am trying to get a currency editor control to work but no luck. I've copied the code from the page designer into my razor view but it does not display correctly.
I don't know what goes in the layout file vs the view. Any help on how to get the basics working is greatly appreciated.
Hello David,
Thank you for contacting Infragistics. Did you try calling Render, as explained in our documentation?
No
Severity Code Description Project File Line Suppression State Error CS1061 'IHtmlHelper<dynamic>' does not contain a definition for 'Infragistics' and no accessible extension method 'Infragistics' accepting a first argument of type 'IHtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?) IgniteUI C:\Users\Dave\OneDrive\IgniteUI\IgniteUI\Views\Home\Privacy.cshtml 2 Active
I do have the sample working now. However, I am not able to get Ifragistics working in a new MVC Core project.
The new project was created in VS2019 using the template:
MVC Core with Controllers and Views
When I copy the sample code into the new project, I get the same error message:
Error CS1061 'IHtmlHelper<dynamic>' does not contain a definition for 'Infragistics' and no accessible extension method 'Infragistics' accepting a first argument of type 'IHtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?) IgniteUI C:\Users\Dave\OneDrive\IgniteUI\IgniteUI\Views\Home\Privacy.cshtml
All of the control definitions such as this one
<div class="group-fields"> <label for="lastName">Last Name</label> @(Html.Infragistics().TextEditor() .ID("lastName") .InputName("lastName") .PlaceHolder("Anderson") .Render() )
</div>
Throw a compile error.
I have copied the sample code into an empty view named Privacy.cshtml
The new project structure is very different than the MVC sample that you provided.
What can I check or add to the project? Thanks for your help.
I have created and attached a sample project based on the template you have specified using VS2019.
Please test it on your side and let me know how it behaves.
If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me for further investigation.
Looking forward to hearing from you.
5086.Sample.zip
Hi,
I just downloaded the sample and tested it. It is working!
Thank you, but unfortunately, I don't understand why it is not working in my application.
Can you provide guidance on where to check for problems? Do you have an approach for debugging that I could follow?
Since the sample I have provided works on your side, what I can suggest is to start gradually adding the code from your project to it, until the issue is reproduced. You can then attach the sample here so I can investigate the issue further.
Hi, I found the problem. As soon as I added the controls, I got the error message again. The message said I needed to add a reference to System.Web.Mvc assembly. This assembly doesn't appear in the list when you try to add a reference using the reference dialog. This is where I had been stuck.
I found a solution online. I added the package micrsoft.aspnet.mvc. That cleared the error messages up and everything is now working.
I don't know why I needed to add this package. The only thing I can think is that I was using VS2019 community version. Maybe it doesn't provide the same template as the full VS2019.
I am glad that everything works as expected on your side.
Please let us know if you need any further assistance with this matter.
Hi, thanks for the info. Something is not right as this is how I started this case:
"I created a new ASP.NET Core with controllers and views in Visual Studio 2019."
I used the ASP.NET core project template. I've done this several times so I am fairly certain that I'm picking the right one. It is easy to get confused. Again I added Microsoft.ASP.MVC in the Nuget package manager to my .NET Core project as it did not.
I will look at the stackflow answer to see if that makes any sense.
Right now, everything is working to thanks again.
I am glad that you have resolved your issue.
Please note, however, that the VS2019 template should be identical in all the versions of the IDE. Additionally, based on the error message, it appears that the project you are using is on ASP.NET and not .NET Core since the System.Web.Mvc namespace is for the former framework. This StackOverflow answer might be of help to you.
Please let me know if you need any further assistance with this matter.