Asp.net DropdownList不';不能在移动设备上工作
我的页面中有两个下拉列表。在网络浏览器(PC端)中工作正常。没问题。当我用ChromeToogle设备工具栏打开页面并将其调整为移动视图时,它只会给出这个错误Asp.net DropdownList不';不能在移动设备上工作,asp.net,asp.net-mvc,Asp.net,Asp.net Mvc,我的页面中有两个下拉列表。在网络浏览器(PC端)中工作正常。没问题。当我用ChromeToogle设备工具栏打开页面并将其调整为移动视图时,它只会给出这个错误 fastclick.js:1 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/509
fastclick.js:1 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
csHTML代码
<div class="tab-pane active tabcontent" id="reservationPage" role="tabpanel">
<div class="col-sm-12 col-md-12">
<div class="form-group row rowR">
<label class="form-control-label col-md-2"><strong>Yemekhane</strong> </label>
<div class="col-md-12">
@Html.DropDownListFor(x => x.RefectoryId, new SelectList(Model.Refectories, "Id", "Name"), ("Seçiniz"), new { Id = "RefectoryId", @class = "form-control select2" })
</div>
</div>
<div class="form-group row rowR">
<label class="form-control-label col-md-2"><strong>Öğün</strong> </label>
<div class="col-md-12">
@Html.DropDownListFor(x => x.FoodMealId, new SelectList(Model.FoodMeals, "Id", "Name"), ("Seçiniz"), new { Id = "FoodMealId", @class = "form-control select2" })
</div>
</div>
</div>
</div>
Yemekhane
@DropDownListFor(x=>x.RefectoryId,新选择列表(Model.Refectories,“Id”,“Name”),(“Seçinizing”),新{Id=“RefectoryId”,@class=“form control select2”})
ğğn
@DropDownListFor(x=>x.FoodMealId,new SelectList(Model.FoodMeals,“Id”,“Name”),(“Seçinizing”),new{Id=“FoodMealId”,@class=“form control select2”})
JS代码
<script>
var reservationCount = 0;
var totalAmount = 0;
$(document).ready(function () {
$("#reservationCount")[0].textContent = "(" + reservationCount + ")";
//İlk açıldığında rezervasyon sayfasının acık gelmesi için
var tablinks = document.getElementById("reservationPageHead");
tablinks.className = tablinks.className + " active";
document.getElementById('reservationPage').style.display = "block";
//var foodMealId = $("#FoodMealId").val();
//var refectoryId = $("#RefectoryId").val();
//GetCalendarMenuPartial(foodMealId, refectoryId);
$("#RefectoryId").select2({
allowClear: true,
placeholder: 'Yemekhane Seçiniz',
// dropdownParent: $(".bootbox-body"),
});
var refectorySelect = $('#RefectoryId');
refectorySelect.on("select2:select", function (e) {
var foodMealId = $("#FoodMealId").val();
var refectoryId = $("#RefectoryId").val();
$.ajax({
url: "@Url.Action("GetRefectoryWithFoodMeal", "Reservation", new { area = "Common" })",
data: { refectoryId: refectoryId },
type: "POST",
async: false,
success: function (returnData) {
if (returnData.data == undefined) {
PageToastr(returnData.type, returnData.message, returnData.title);
}
else {
//FoodMeal List
$("#FoodMealId option[value]").remove();
$("#FoodMealId").select2({
allowClear: true,
placeholder: 'Seçiniz',
data : returnData.data,
});
}
},
beforeSend: function () {
$(".loaderDiv").show();
$(".loader").show();
},
complete: function () {
$(".loaderDiv").hide();
$(".loader").hide();
},
error: function (xhr, status, err) {
if (xhr.status === 999) {
noAuthorize(this.url);
}
}
});
var foodMealId = $("#FoodMealId").val();
var refectoryId = $("#RefectoryId").val();
GetCalendarMenuPartial(foodMealId, refectoryId);
});
$("#FoodMealId").select2({
allowClear: true,
placeholder: 'Öğün Seçiniz',
//dropdownParent: $(".bootbox-body"),
});
var foodMealSelect = $('#FoodMealId');
foodMealSelect.on("select2:select", function (e) {
var foodMealId = $("#FoodMealId").val();
var refectoryId = $("#RefectoryId").val();
GetCalendarMenuPartial(foodMealId, refectoryId);
});
// Rezervasyonu tamamla için tooltip
$('#completeReservation').tooltip('update');
});
</script>
<script>
function GetCalendarMenuPartial(foodMealId, refectoryId) {
$.ajax({
url: '@Url.Action("NewReservationCalendarMenuPartial", "Reservation", new { area = "Common" })',
data: { foodMealId: foodMealId, refectoryId: refectoryId, addCardMenu: $("#AddCardMenuString").val() },
type: "POST",
success: function (partialPage) {
if (partialPage.title != undefined) {
PageToastr(partialPage.type, partialPage.message, partialPage.title);
if (partialPage.result == '@Enums.ResultStatus.SessionTimeExpired.ToString()') {
setTimeout(function () { window.location.href = '/Login/Login'; }, 5000)
}
}
else {
$("#calendarMenuPartial").html(partialPage);
}
},
beforeSend: function () {
$(".loaderDiv").show();
$(".loader").show();
},
complete: function () {
$(".loaderDiv").hide();
$(".loader").hide();
},
error: function (xhr, status, err) {
if (xhr.status === 999) {
noAuthorize(this.url);
}
}
});
}
</script>
var reservationCount=0;
var totalAmount=0;
$(文档).ready(函数(){
$(“#reservationCount”)[0]。textContent=“(+reservationCount+”);
//阿尔卡·阿尔德·兰达·雷泽瓦西恩·萨伊法斯·纳克·盖尔梅西·伊恩
var tablinks=document.getElementById(“reservationPageHead”);
tablinks.className=tablinks.className+“活动”;
document.getElementById('reservationPage').style.display=“block”;
//var foodMealId=$(“#foodMealId”).val();
//var refectoryId=$(“#refectoryId”).val();
//GetCalendarMenuPartial(foodMealId、RefectorId);
$(“#RefectoryId”)。选择2({
allowClear:是的,
占位符:“Yemekhane Seçinizing”,
//dropdownParent:$(“.bootbox body”),
});
var refectorySelect=$(“#RefectoryId”);
refectorySelect.on(“select2:select”,功能(e){
var foodMealId=$(“#foodMealId”).val();
var refectoryId=$(“#refectoryId”).val();
$.ajax({
url:@url.Action(“GetRefectoryWithFoodMeal”,“Reservation”,new{area=“Common”})”,
数据:{refectoryId:refectoryId},
类型:“POST”,
async:false,
成功:函数(返回数据){
if(returnData.data==未定义){
PageToastr(returnData.type、returnData.message、returnData.title);
}
否则{
//食物清单
$(“#FoodMealId选项[value]”)。删除();
$(“#FoodMealId”)。选择2({
allowClear:是的,
占位符:“Seçinizing”,
数据:returnData.data,
});
}
},
beforeSend:函数(){
$(“.loaderDiv”).show();
$(“.loader”).show();
},
完成:函数(){
$(“.loaderDiv”).hide();
$(“.loader”).hide();
},
错误:函数(xhr、状态、错误){
如果(xhr.status==999){
无授权(this.url);
}
}
});
var foodMealId=$(“#foodMealId”).val();
var refectoryId=$(“#refectoryId”).val();
GetCalendarMenuPartial(foodMealId、RefectorId);
});
$(“#FoodMealId”)。选择2({
allowClear:是的,
占位符:“ğğn Seçinizing”,
//dropdownParent:$(“.bootbox body”),
});
var foodMealSelect=$(“#FoodMealId”);
foodMealSelect.on(“select2:select”,函数(e){
var foodMealId=$(“#foodMealId”).val();
var refectoryId=$(“#refectoryId”).val();
GetCalendarMenuPartial(foodMealId、RefectorId);
});
//工具提示中的Rezervasyonu tamamla iç
$(“#CompleteServation”)。工具提示(“更新”);
});
函数GetCalendarMenuPartial(foodMealId,refectoryId){
$.ajax({
url:'@url.Action(“NewReservationCalendarMenuPartial”,“Reservation”,new{area=“Common”})”,
数据:{foodMealId:foodMealId,refectoryId:refectoryId,addCardMenu:$(“#AddCardMenuString”).val(),
类型:“POST”,
成功:功能(部分页面){
if(partialPage.title!=未定义){
PageToastr(partialPage.type、partialPage.message、partialPage.title);
if(partialPage.result='@Enums.ResultStatus.SessionTimeExpired.ToString()')){
setTimeout(函数(){window.location.href='/Login/Login';},5000)
}
}
否则{
$(“#calendarMenuPartial”).html(partialPage);
}
},
beforeSend:函数(){
$(“.loaderDiv”).show();
$(“.loader”).show();
},
完成:函数(){
$(“.loaderDiv”).hide();
$(“.loader”).hide();
},
错误:函数(xhr、状态、错误){
如果(xhr.status==999){
无授权(this.url);
}
}
});
}
在那之后,我增加了触摸动作:无;但它也不起作用。它在PC设备中正常工作。但在移动设备上永远不起作用