How to create picture link in ASP.NET MVC?

ajax, asp.net-mvc, jquery

Solution

I think this is the basic idea. You can fill in the details/adapt as needed to your markup and model/actions.

$('.upvote').click( function() {
    $(this).addClass('highlight');
    $(this).nextAll('.downvote:first').removeClass('highlight');
    $.post( '<%= Url.Action( "vote", new { id = Model.ID } %>', { vote: 'up' } );
});

$('.downvote').click( function() {
   $(this).addClass('highlight');
   $(this).prevAll('.upvote:first').removeClass('highlight');
   $.post( '<%= Url.Action( "vote", new { id = Model.ID } %>', { vote: 'down' } );
});

Problem

Well, how to create picture link like this up or down votes (on the left) from link below? (ajax enabled link) ``` <%= Ajax.ActionLink("Vote!", "AddPictureVote", "Vote", new {id = Model.PictureId}, new AjaxOptions{UpdateTargetId = "addvote"})%> ```

Original source