how selected data can i pass to controller in mvc code example
Example 1: pass data from one controller to another controller mvc
public ActionResult Index()
{
TempData["mydata"] = data;
}
Example 2: how to pass view data to controller in mvc
<h2>Calculate Simple Interest</h2>
<fieldset>
<legend>Calculate Simple Interest</legend>
@using (Ajax.BeginForm("CalculateSimpleInterestResult","CalculateSimpleInterest",
new AjaxOptions { UpdateTargetId = "divInterestDeatils" }))
{
<div id="divInterestDeatils"></div>
<ol>
<li>
@Html.Label("Amount")
@Html.TextBox("txtAmount")
</li>
<li>
@Html.Label("Rate")
@Html.TextBox("txtRate")
</li>
<li>
@Html.Label("Year")
@Html.TextBox("txtYear")
</li>
</ol>
<button>Calculate</button>
}
</fieldset>