Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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>
Posted
Updated 28-Jun-11 0:13am
v5
Comments
Slacker007 28-Jun-11 6:13am    
Edited for readability, spelling, and grammar. Added tag.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900