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 have not seen this before, did you mean you didn't try using the Render? If not, it is required. Try running this sample, and use it as a baseline.
https://filetransfer.infragistics.com/public.php?service=files&t=ce99fa613b6a76913267e8af6500e3fd
I sent a reply just now but you may not have received it. I need to try one more thing to see if I can get the sample to compile.
Hi, thank you. This sample is working now. I have a few questions.
This sample application has a folder structure much different than what I am used to. There is no webroot folder that is present when you create a web MVC project in visual studio 2019.
1 Does the folder structure need to match this sample in order for it to work?
2. Do the CSS files need to be in a Scripts folder in order to work?
I am unclear on how link references and script references work. Still learning this aspect of MVC development.
There is no Views\Shared folder and no _Layout.CSHTML file in the Shared folder.
3. Do the links and scripts reference in the view need to be in the view or can they be in the _Layout.cshtml file?
One thing that should be updated/noted in your documentation is that the Visual Studio 2019 Community edition does not align with Microsoft documentation and there is no way to add references.
4. I see many references in this project that are not in mine. When I tried to add these references, they did not show up in the list. Do you know if this is another shortcoming of the
Thanks for your help.
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
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.
Hi,
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.
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.
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.