3,597 questions
Hi @Padma Anantha Krishnan
Pass the value to the backend through input, and finally use the Razor method to pass the value of the backend to the frontend.
Code:
<form action="/Home/About" method="post">
<div>
<input type="text" name="text"/>
<input type="submit" value="button"/>
</div>
<div>
<a href=@Url.Action(@ViewBag.Message)>Action</a>
</div>
</form>
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
string text=Request.Form["text"];
ViewBag.Message = text;
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
{
return "static name";
}
public string GetName1()
{
return "name";
}
}
Result:
Best regards,
Qi You
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.