Hi nauna,
Check this example. Now please take its reference and correct your code.
Controller
Home
public class HomeController : Controller
{
// GET: /Home/
public ActionResult Index()
{
return View();
}
}
Details
public class DetailsController : Controller
{
// GET: /Details/
public ActionResult Index()
{
return View();
}
public ActionResult Details(string name, string mobile)
{
TempData["Name"] = name;
TempData["Mobile"] = mobile;
return View();
}
}
View
Home
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Index</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.js"></script>
<script type="text/javascript">
$(function () {
$('.Redirect').on("click", function () {
var name = $('#TxtName').val();
var mobile = $('#TxtMobile').val();
var url = $(this).attr('href') + '?Name=' + name + '&Mobile=' + mobile;
location.href = url;
return false;
});
});
</script>
</head>
<body>
<div>
<%using (Html.BeginForm()) {%>
<table>
<tr>
<td>Enter Your Name</td>
<td>:</td>
<td><%:Html.TextBox("TxtName")%></td>
</tr>
<tr>
<td>Enter Your Mobile No</td>
<td>:</td>
<td><%:Html.TextBox("TxtMobile")%></td>
</tr>
<tr>
<td>Enter Your EmailID</td>
<td>:</td>
<td><%:Html.TextBox("TxtEmailID")%></td>
</tr>
<tr>
<td>Enter Your Address</td>
<td>:</td>
<td><%:Html.TextBox("TxtAddress")%></td>
</tr>
</table>
<%:Html.ActionLink("Create", "Details", "Details", new { }, new { @class = "Redirect" })%>
<%} %>
</div>
</body>
</html>
Details
<body>
Name : <%=TempData["Name"]%><br />
Mobile : <%=TempData["Mobile"]%>
</body>
Screenshot