The default behavior for Ajax helpers will not support this. However, you can create your own JavaScript handler that runs when the Ajax request returns, and then use it to insert the value into the attribute
Create a shared JavaScript file (for example, upload it on the main page) and add this function:
function createAttributeInjector(attributeName) {
return function(ajaxContext) {
if(ajaxContext.get_updateTarget() !== null) {
ajaxContext.get_updateTarget()[attributeName] = ajaxContext.get_data();
}
return false;
}
}
Then, creating an Ajax link:
Ajax.ActionLink("Change IMG Source", "actionChange", new AjaxOptions() {
UpdateTargetId="CHANGE-MY-SRC",
OnCompleted="createAttributeInjector('src')"
}
: , Ajax. , , ! , !
( CodePlex), AjaxContext.cs MicrosoftMvcAjaxScript , OnCompleted