确定点击了哪个链接 [英] Identify which link is clicked

查看:78
本文介绍了确定点击了哪个链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个
< a id ="y1"> 1</a> < a id ="y2"> 2</a>
在页面中.我需要在控制器页面中访问它.我该怎么办?

我这样尝试过:

I have an
<a id="y1">1 </a> <a id="y2">2</a>
in a page.I need to access it in the controller page. How can I do it?

I tried like this:

[HttpPost]
public ActionResult Event(FormCollection form)
{           
  form.GetValue("y1");          
  return View();       
}



但是我得到的是空值.



But I am getting null value.

推荐答案


只需将身份作为查询字符串传递即可,然后您就可以识别所单击的链接..

just pass the identity as query string then u can identify the clicked link..


请查看此链接,以获取有关此方面的一些不错的提示:

http://odetocode. com/blogs/scott/archive/2009/04/27/6-tips-for-asp-net-mvc-model-binding.aspx [
Have a look at this link for some good tips on this:

http://odetocode.com/blogs/scott/archive/2009/04/27/6-tips-for-asp-net-mvc-model-binding.aspx[^]

Good luck!


这篇关于确定点击了哪个链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆