I suggest you to use this function for ajax.actionlink
public static MvcHtmlString ActionLink(
this AjaxHelper ajaxHelper,
string linkText,
string actionName,
Object routeValues,
AjaxOptions ajaxOptions,
Object htmlAttributes
)
In the htmlAttributes, you can give the new {class='lnk'}
Use jQuery to find the link which you are clicked using $(this)
You can also get the parent, next html elements.
Eg (jQuery):
$('.agree').live("click", function(){
var currentId2 = $(this).parents(".user").attr('id');
alert (currentId2);
call the function() you are supposed to call in ActionBegin
});
A sample demo, in that I have lot of div and I have a link on each. I need to find the clicked link (all links are having class with name as agree
.
Another references
How to use $(this) inside MVC3 Ajax.ActionLink OnBegin,OnComplete Events