I'm using ASP.NET 5 RC1.
What is the equivalent in ASP.NET 5
MVC 6
of @Ajax.ActionLink
Example:
@Ajax.ActionLink("Show",
"Show",
null,
new AjaxOptions { HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "dialog_window_id",
OnComplete = "your_js_function();" })
as used in ASP.NET 4
MVC 5
.
I get:
The name 'Ajax' does not exist in the current context.
in ASP.NET 5
Update:
I understand it is not going to be implemented. Is it possible someone can provide me with the taghelper code example alternative?
I would go a limb here and say that it's not a helper at that point.
It's a component. It is not simply HTML but also JavaScript. Once you have JavaScript tied to a component, which framework are you using? Are you using pure JavaScript?
If this component is tied to pure JavaScript (no jQuery), it will need to be updated/tested for all current, previous and future versions of every browsers.
And that, is why I'm thinking that it was left to be built as a component rather than built into the framework itself.
Too many moving pieces, too many dependencies on frameworks/software that the client can and will change.
As for a solution, my recommendation is to go with jQuery or something along those lines.
HTML
<a class="ajaxLink" href="#" data-href="/Project" data-method="DELETE">Delete Project</a>
JavaScript
$(document).ready(function() {
$("a.ajaxLink").on('click', function (){
var self = this;
$.ajax({
type: $(this).attr('data-method'),
url: $(this).attr('data-href')
}).then(function() {
// success callback
});
});
});
As you can see, this can become quite easily a simple client-side solution rather than a server side solution.
I hope this answers your question and solves your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With