0
我的代碼是:我的代碼在部分視圖(ascx)中不起作用?
<script type="text/javascript">
$(document).ready(function() {
alert("dd");
//Attach cascading behavior to the orderID select element.
$("#orderID").CascadingDropDown("#customerID", '/Home/AsyncOrders',
{
promptText: '-- Pick an Order--',
onLoading: function() {
$(this).css("background-color", "#ff3");
},
onLoaded: function() {
$(this).animate({ backgroundColor: '#ffffff' }, 300);
}
});
//Attach cascading behavior to the orderDetails select element.
$("#orderDetails").CascadingDropDown("#orderID", '/Sales/AsyncOrderDetails',
{
promptText: '-- Pick an Order Detail --',
onLoading: function() {
$(this).css("background-color", "#ff3");
},
onLoaded: function() {
$(this).animate({ backgroundColor: '#ffffff' }, 300);
}
});
//When an order detail is selected, fetch the details using ajax
//and display inside a div tag.
$('#orderDetails').change(function() {
if ($(this).val() != '') {
$.post('/Sales/OrderDetails', $(this).serialize(), function (data) {
$('#orderDetailsContainer').html(data).effect("highlight", {}, 3000);
});
}
});
});
</script>
<div id="searchFilter">
Custom text in select lists, lists highlight when loading.<br />
<%:Html.DropDownList("customerID", Model, "-- Select Customer --")%>
<%-- <%:Html.DropDownList("cites", ViewData["xml"] as SelectList , "-- Select Customer --")%>--%>
<select id="orderID" name="orderID">
</select>
<select id="orderDetails" name="orderDetails">
</select>
</div>
<div id="orderDetailsContainer">
</div>
,當它寫在頁面(ASPX)非常難得運行
,但在使用時局部視圖(ASCX)不運行的代碼?
添加更多有關什麼不工作的細節以及如何渲染局部視圖 –
嗨,這段代碼使用前級聯下拉列表,這是第一個顯示列表單元,當它改變時,其他drodownlist顯示本單元的列表。在頁面(aspx)中使用此代碼運行非常神,但使用Partial VIew(ascx)時不運行 – user818566