Hello, I'm creating a site using ASP.Net Core 3.1, with IgniteUI 19.2.25 and Infragistics.Web.AspNetCore 6.19.22.
The MVC helpers for the more common controls (ComboFor, TextEditorFor) all work without a problem.
However, the helpers for NumericEditorFor, DatePickerFor, and MaskEditorFor are not generating the model field name for the hidden input tag associated with the control. When I inspect the element, the name field is missing, while it is generated for the igCombo and the igTextEditor.
Any suggestions?
Has anyone in the team had a look? If it's working for others in the same circumstances (I'm also using Razor Pages, rather than straight MVC), then at least I can try digging in to that or I can create a small example that reproduces the problem. If not, it would be great to know whether it's being looked into.
Hello Rob V,
Thank you for your feedback! We will appreciate if you can attach a runnable code sample reproducing the issue. It will both speedup investigating the matter as well as make sure we are on the same page.
I took this from the tutorial sample on https://docs.microsoft.com/en-gb/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-3.1. I modified the project to include newer versions of jquery and jquery.ui, then added the packages for igniteUI and Infragistics.Web.AspNetCore.
I changed the Create.cshtml page to use IgniteUI controls instead of the default input controls.
I was using the infragistics css and js locally, but I removed them from the zipped sample to conserve space.
@page @using Infragistics.Web.Mvc; @model RazorPagesMovie.Pages.Movies.CreateModel @{ ViewData["Title"] = "Create"; } <link type="text/css" href="@Url.Content("~/css/themes/infragistics/infragistics.theme.css")" rel="stylesheet" /> <link type="text/css" href="@Url.Content("~/css/structure/infragistics.css")" rel="stylesheet" /> <script type="text/javascript" src="~/lib/jquery/dist/modernizr.min.js"></script> <script type="text/javascript" src="~/lib/jquery/dist/jquery.min.js"></script> <script type="text/javascript" src="~/lib/jquery/dist/jquery-ui.min.js"></script> <script type="text/javascript" src="~/js/infragistics.core.js"></script> <script type="text/javascript" src="~/js/infragistics.lob.js"></script> <script type="text/javascript" src="~/js/modules/i18n/regional/infragistics.ui.regional-en.js"></script> <h1>Create</h1> <h4>Movie</h4> <hr /> <div class="row"> <div class="col-md-4"> <form method="post"> <div asp-validation-summary="ModelOnly" class="text-danger"></div> <div class="form-group"> <label asp-for="Movie.Title" class="control-label"></label> <div> @(Html.Infragistics().TextEditorFor(model => model.Movie.Title) .ID("TitleEditor") .InputName("TitleInput") .PlaceHolder("Movie Title") .Render() ) </div> <span asp-validation-for="Movie.Title" class="text-danger"></span> </div> <div class="form-group"> <label asp-for="Movie.ReleaseDate" class="control-label"></label> <div> @(Html.Infragistics().DatePickerFor(model => model.Movie.ReleaseDate) .ID("datePicker") .Render()) </div> <span asp-validation-for="Movie.ReleaseDate" class="text-danger"></span> </div> <div class="form-group"> <label asp-for="Movie.Genre" class="control-label"></label> <div> @(Html.Infragistics().TextEditorFor(model => model.Movie.Genre) .ID("GenreEditor") .InputName("GenreInput") .PlaceHolder("Genre") .Render() ) </div> <span asp-validation-for="Movie.Genre" class="text-danger"></span> </div> <div class="form-group"> <label asp-for="Movie.Price" class="control-label"></label> <div> @(Html.Infragistics().NumericEditorFor(model => model.Movie.Price) .ID("priceEditor") .DataMode(NumericEditorDataMode.Double) .MinValue(0) .MaxDecimals(2) .Value(0) .Width(120) .Render()) </div> <span asp-validation-for="Movie.Price" class="text-danger"></span> </div> <div class="form-group"> <label asp-for="Movie.Rating" class="control-label"></label> <div> @(Html.Infragistics().TextEditorFor(model => model.Movie.Rating) .ID("ratingEditor") .Render()) </div> <span asp-validation-for="Movie.Rating" class="text-danger"></span> </div> <div class="form-group"> <input type="submit" value="Create" class="btn btn-primary" /> </div> </form> </div> </div> <div> <a asp-page="Index">Back to List</a> </div> @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} }
Please let me know if you're able to run, and to reproduce my problem. In this case, the first four items generated by the helpers did not bind properly to the model.
The zipped solution is at the following link. The LocalDB may need to be recreated with Update-Database in the package manager console.
Onedrive zipfile link
Thanks Nikolay!
Hi, Rob.
Thank you once again! I've transferred your case to our internal system and associated issue #267922 with your case. You can follow its progress and I will notify you when the fix is available.
Regards,
Nikolay Alipiev
Software Developer
Hi Nikolay,
I implemented the workaround today by setting the InputName for the bound field and it passed testing for the implementation that I'm working on, so I can wait for the Service Release,. In the meantime, the workaround may help others facing the same issue until the SR.
Best regards,
Rob
Rob V, thank you very much for the catch!
You are correct and we are currently working on fixing that in all the components. Our next Service Release is scheduled on 24 of March 2020, however every two weeks we are producing a Bi-weekly build and could include the fix. We always suggest using Service Release builds because they pass a regression testing, however, we can deliver the fix depending on your needs.
A temporary solution can be to set the inputName property, using the client widget. Please tell me what you think and how you would like to proceed.
Please check the Infragistics.Web.AspNetCore source code. I believe that the problem is in the Editors\EditorExtensions.cs.
The "InternalTextEditor" looks ok, but I think that the wrapper.ID and wrapper.InputName are set incorrectly for the other InternalXXXEditor methods.
Instead of:
if (string.IsNullOrEmpty(id)) { wrapper.ID(id); } if (string.IsNullOrEmpty(fullName)) { wrapper.ID(fullName); }
They should have:
if (!string.IsNullOrEmpty(id)) { wrapper.ID(id); } if (!string.IsNullOrEmpty(fullName)) { wrapper.InputName(fullName); }
Please let me know if that change is correct, and if so when I can get a service release/hotfix.
Thanks!