Reputation: 854
I have an imagelink extension that i am using to navigate to another view. Once the user chooses a value from a dropdown list and clicks the link, i need to navigate to the next view and pass the value of their selection. Everything is working, except for the action i am passing to is being hit twice. I cannot seem to wrap my head around why this is happening.
View
<div class="locationSelection">
@(Html.Kendo().DropDownList()
.Name("locationList")
.DataTextField("DisplayName")
.DataValueField("LocationCode")
.BindTo(Model)
.OptionLabel(new { DisplayName = "Select Your Location....", LocationCode = "NA" })
)
</div>
<div id="userSelection">
<div id="currentQueue">
@Html.ImageLink("/Images/CurrentPickups.jpg", "Search", "Search", "Manage Current Pickups")
</div>
<div id="previousSubmissions">
@Html.ImageLink("/Images/PreviousSubmissions.jpg", "Search", "searchPrevious", "Search Previous Pickups")
</div>
<div>
</div>
</div>
<script type="text/javascript">
$("#userSelection a").click(function (e) {
e.preventDefault();
var href = $(this).attr('href');
var dropdownlist = $("#locationList").data("kendoDropDownList");
if (dropdownlist.value() != "NA") {
var route = href + "?locationCode=" + dropdownlist.value();
window.location.href = route;
} else {
alert("A valid location must be selected!");
}
});
</script>
Upvotes: 0
Views: 806
Reputation: 854
The target view had the exact same imagelink in it as the one i was clicking. Im not sure why that caused the action to be hit twice, but removing it resolved the issue.
Upvotes: 1