MVC:代码不在部分视图(ascx)中运行 [英] MVC: Code does not run in Partial View(ascx)
本文介绍了MVC:代码不在部分视图(ascx)中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码在我的网页(aspx)中很好地工作,但是当我在Partial View(ascx)中运行它时,它无法工作/运行.您能给我一些如何解决此问题的指示吗.
我的代码是:
Hi,
My code works in my web page(aspx) very good but when I run it in Partial View (ascx) it does not work/run. Can you give me some pointers on how to fix this.
My code is:
<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>
推荐答案
(document).ready(function(){ alert("dd"); //将级联行为附加到orderID选择元素.
(document).ready(function () { alert("dd"); //Attach cascading behavior to the orderID select element.
(#orderID").CascadingDropDown(#customerID",``/Home/AsyncOrders'', { hintText:``-接单-'', onLoading:function(){
("#orderID").CascadingDropDown("#customerID", ''/Home/AsyncOrders'', { promptText: ''-- Pick an Order--'', onLoading: function () {
(this).css("background-color",#ff3"); }, onLoaded:function(){
(this).css("background-color", "#ff3"); }, onLoaded: function () {
这篇关于MVC:代码不在部分视图(ascx)中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文