Click here to Skip to main content
16,016,669 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
cshtml Code :

@using (Html.BeginForm("Btn_LoginClick", "Home", FormMethod.Post))
{
<input type="submit" id="Btn_Login" name="submit" value="ورود" class="button" />
}


Controller Code :


Collapse | Copy Code
public ActionResult Register()
{
return View();
}
[HttpPost]
public ActionResult Btn_LoginClick() {
return RedirectToAction("Register");
}
Posted

VB
Hi,

Do not passed FormMethod in BrginForm. As from your code it looks like you are returning view. So you getting result, so it will be HttpGet. SO do not pass that FormMethod.
 
Share this answer
 
C#
@using (Html.BeginForm("ActionName", "Controller"))
{


}

No need of using Post here in view since you set that above your action.


you can use return
View("url",object);
you can use like this also..!!!

incase of redirection
return RedirectToaction("Action",new{id=idvalue})


if you want to pass any parameter value from here u can use above methods.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900