2011-06-28 4 views
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)を使用する場合、コードを実行しませんか?

+0

追加に書き込まれません何がうまくいかないか、部分表示をレンダリングする方法の詳細 –

+0

このコードでは、カスケードドロップダウンリストを使用して最初のリストを表示し、他の場合はドロップダウンリストを変更します。このユニットの引用を表示します。ページ(aspx)でこのコードを使用すると非常に神が動作しますが、部分的なVIEW(ascx)を使用すると実行されません – user818566

答えて

0

コロンの点に注意してください。あなたはどちらか、この

<% Html.RenderPartial("YourUserControl"); %> 

か(のようにそれを行うことを確認してください(:))

<%: Html.Partial("YourUserControl"); %> 

またはあなたの部分図は、文書

関連する問題