Asp.net tag helpers not worked in my project.
I add this code to project.json
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
in _ViewImports.cshtml
i add
@using Homebank
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
When in view i use asp.net tag helpers - page not return data;
@model Homebank.Models.Admins
@{
ViewData["Title"] = "Create";
}
<input asp-for="Email" class="form-control" />
Not errors, not exceptions. White page
Your tag helper is trying to access Homebank.Models.Admins.Email
. Make sure that class has an Email
property.
namespace Homebank.Models
{
public class Admins
{
public string Email { get; set; }
}
}
I think that is the most likely fix, because your code works when you remove the Email
tag helper. Here are some other ideas, though.
Instead of a white screen, we can receive a detailed error page. Add the following line of code to the Configure
method.
public void Configure(IApplicationBuilder app)
{
// other code omitted for clarity
app.UseDeveloperExceptionPage();
app.UseMvc();
}
That will provide more debugging information. E.g.
It might be that you need to restore the Microsoft.AspNet.Mvc.TagHelpers
package. Here is how from the command line:
dnu restore
dnu build
dnx web
This is an unlikely fix, because your code runs when you comment out the Email
tag helper, even though you're using tag helpers in the _ViewImports.cshtml
page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With