I have a controller that is being called twice from an ActionLink call.
My home page has a link, that when clicked calls the Index method on the Play controller. An
Something very stupid I did...had 2 Forms on a page with one button on each form. I had added script to submit a specific form based on the button clicked but, since the default action of a button on a form is to do a submit, it called my Controller Action twice. :^(
$('#SaveButton').click(function (event) {
$("#AttendanceDetailForm").submit();
});
You can step through the code in your view. Step through and see where the second call comes from.
Try changing the int? id
to int id
. It's matching the route the 2nd time because you're calling the index again with a null id.
I was chasing my problem and found it in here:
Had <div style="width: 200px; height: 200px; background-image: url('\Asd\image.jpg')"></div>
and problem made \
character so inside server side code i replaced all \
with /
and it is working as charm.