Razor.Templating.Core
Razor.Templating.Core copied to clipboard
Form action method not forming
When we use regular <form> attribute with asp-controller and asp-action html tag helpers then final output does not contain action property of form, instead it contains blank action value on specified <form> like <form action="" method="post">... </form>
Any solution please?
Hi @dev-vkagrawal, are you rendering the .cshtml file from console app or mvc?
Hi @soundaranbu it is from mvc application. From controllers' action method I want to return view's string content along with some other couple of data. Everything seems returning properly except the form action value when used with asp-controller and asp-action.
Ok I'll look into it this weekend. Between what version of dotnet and the library are you using?
I am using .Net Core 3.1 and nuget package version of library is 1.6.0
Thanks @soundaranbu can you please tell me which version of nuget package with a fix would be compatible with .Net core 3.1 ?
Hi @dev-vkagrawal , Currently the fix is in testing phase. I'll release a preview version in one or two days. I'll let you know by then. Thanks
Hi @dev-vkagrawal, I've made a pre-release v1.6.1-rc.1. please it try out and let me know https://www.nuget.org/packages/Razor.Templating.Core/1.6.1-rc.1
Thanks.
Hi @soundaranbu it does not seem working with either version. Still action property of < form > is blank.
Ok that's weird. if possible, please send a sample project to reproduce the issue. otherwise, it'll be hard to look into this further. thanks!
It is simple .net core mvc project and I have regular view with form element and action property on it. When trying to get html of such view then just action property is blank in resultant view string.
Ok then you might need to take a look at this sample mvc project which renders the form action method properly and let me know how it works for you.
Checkout branch: release/1.6.x
https://github.com/soundaranbu/RazorTemplating/tree/release/1.6.x/examples/Mvc/ExampleWebApp.NetCore3_1
Look for this action method: https://github.com/soundaranbu/RazorTemplating/blob/1ff2c21c0ee4b9bd218f4b6f0cca93898dee6264/examples/Mvc/ExampleWebApp.NetCore3_1/Controllers/HomeController.cs#L66-L70
Output Url: /Home/TagHelpers
Template:

Output:

Hi, I cloned project but solution explorer shows just .Net 6 project, while I am trying to see .Net Core 3.1 project to test. Can you please tell me what else I need to change to make it work with .net core 3.1?
Please see attached image.

Hi @dev-vkagrawal, it looks like you are in master branch. Please checkout release/1.6.x branch where you can find the project.
Closing this one as I have shown the output with screenshots https://github.com/soundaranbu/Razor.Templating.Core/issues/35#issuecomment-1025310067
In case, if you still have issues, feel free to reopen. Thanks :)