C# 传递给控制器的锚定标记的文本
是否可以将锚定标记的文本传递给控制器C# 传递给控制器的锚定标记的文本,c#,html,asp.net-mvc,C#,Html,Asp.net Mvc,是否可以将锚定标记的文本传递给控制器 <a href="@Url.Action("SearchStudent","Home")">Student Information</a> 这是我的看法 当我点击链接时,我想在控制器中使用“学生信息”(内部文本) 如何以编程方式获取它?(无硬编码) 我用的是C# 提前谢谢。您可以将其作为routeValue传递 在你看来: <a href="@Url.Action("SearchStudent","Home", new {
<a href="@Url.Action("SearchStudent","Home")">Student Information</a>
这是我的看法
当我点击链接时,我想在控制器中使用“学生信息”(内部文本)
如何以编程方式获取它?(无硬编码)
我用的是C#
提前谢谢。您可以将其作为
routeValue
传递
在你看来:
<a href="@Url.Action("SearchStudent","Home", new { innerText = "Student Information" })">Student Information</a>
我有一个例子,如果你真的想发送内部文本控制器 像这样给你的标签上id
<a id="linkData">Student Information</a>
public ActionResult SearchStudent(string data)
{
return Json(data, JsonRequestBehavior.AllowGet);
}
在控制器中添加如下参数
<a id="linkData">Student Information</a>
public ActionResult SearchStudent(string data)
{
return Json(data, JsonRequestBehavior.AllowGet);
}
它将向函数(结果)和警报(结果)返回数据,以显示内部文本。
希望你能理解我。我的英语不好。你想什么时候将文本传递给控制器?你在标记中添加了任何动态值吗?@Vengadesh-不,它的静态效果非常好。!多谢。我已经试过了,但之前错过了一些东西。