I am trying to use the ViewBag to display the action for a form in a partial page.
I have tried the following:
@using(Html.BeginForm(ViewBag.Action, "Person", FormMethod.Post)
@using(Html.BeginForm((ViewBag.Action), "Person", FormMethod.Post)
@using(Html.BeginForm(@(ViewBag.Action), "Person", FormMethod.Post)
@using(Html.BeginForm({ViewBag.Action}, "Person", FormMethod.Post)
But none of those work. What is the correct syntax?
Try
@using(Html.BeginForm((string)ViewBag.Action, "Person", FormMethod.Post)
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