Formatting MVC 5 Razor link as a string
I can't really comment on your structure in Razor, as I am unfamiliar with that framework, however, your replacing structure could be improved.

By using a function, alongside a dictionary, you can simplify this greatly.

function massReplace(str, dict){
    for (var i in dict){
        str = str.replace(i, dict[i]);
    }
    return str;
}


Whilst also converting the "__id3__", id3 structure into:

var dict = {
    "__id2__": id2,
    "__id3__": id3, 
    "__id4__": id4
};


And then simply:

$('#element').html('&lt;a href="' + massReplace('@Url.Action("Action", "Controller", new { id1= "a", id2= "__id2__" })', dict) + '" target="_blank"&gt;' + data[1] + '&lt;/a&gt;');