Passing Parameters in AJAX MVC Events

I was trying to pass in a parameter to an Ajax OnSuccess event within ASP.NET MVC. Since the event only takes in method names and not method class, that's a problem.

I found a few potential solutions to this floating around, but this one worked for me:

OnSuccess = "function() {myFunction(this);}"

Where myFunction() is:

function myFunction(col) {
$('#divMyAjaxElement').fadeIn('normal');
col.parentNode.style.background = '#444444';
}

My purpose was to change the cell background of a Ajax.ActionLink when it was clicked.

0 comments: