I want to make upvote-downvote panel like stackoverflow in asp.net mvc. If it is upvoted by owner, I want to show warning pane. I m using EF. This is my actionlink.
<a href='@Url.Action("Upvote", "Author")'>
<img src='@Url.Content("~/Images/upvote.png")' width="20" height="20" />
</a>
Can I validate it, on client side or anywhere. On Client side, I have UserID from whom is posted. I want to get the userID which made it upvoted. What is the logic?
I cant write more sample code, because I have no idea, How can I do it.And sorry my poor English.Also, Can any one edit my question, If it is not clear.
Thanks.
You could also use the currently logged in user id on the page, but since you’ll have to verify it again on the server, why not just let the server handle it anyway. If you’re not using AJAX to record the vote (why aren’t you), then it’s simply a matter of doing the check and rendering the view with a message indicating why the vote wasn’t recorded. If you are using AJAX (good for you), then have the vote recording action return some JSON with a status indicating that the vote wasn’t recorded and why, then display the message in a dialog.
In the latter case you might want to use data attributes to record some information to make it easier to form the AJAX request.