none
ToolkitScriptManager和MicrosoftAjax冲突 RRS feed

  • 问题

  • 我在不使用ToolkitScriptManager情况下使用MicrosoftAjax中的方法能正常使用

    当页面中使用了ToolkitScriptManager后运行页面时在MicrosoftAjaxTemplates.debug.js(版本为3.0,4.0的没找到,另外求4.0的下载地址)中

    Sys.Observer.raiseEvent(this, "init");报Microsoft JScript 运行时错误: 无法获取属性“raiseEvent”的值: 对象为 null 或未定义

    代码如下

    <script src="MicrosoftAjax3.0/MicrosoftAjax.debug.js" type="text/javascript"></script>
    <script src="MicrosoftAjax3.0/MicrosoftAjaxTemplates.debug.js" type="text/javascript"></script>

     <script type="text/javascript">
            var products = [{ ProductName: "aa", UnitPrice: 11, UnitsInStock: 10 },
                            { ProductName: "aa", UnitPrice: 11, UnitsInStock: 10 },
                            { ProductName: "aa", UnitPrice: 11, UnitsInStock: 10 },
                            { ProductName: "aa", UnitPrice: 11, UnitsInStock: 10 }
            ];
            var tableView;
           
            function pageLoad() {debugger;
                tableView = Sys.create.dataView("#products", {
                    initialSelectedIndex: 0,
                    selectedItemClass: "selected"
                });
                var detailsView = Sys.create.dataView("#details");
                Sys.bind(detailsView, "data", tableView, "selectedData");
                tableView.set_data(products);
            }
       
        </script>
    </head>
    <body xmlns:sys="JavaScript:Sys">
        <form id="form1" runat="server">
            <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />
            <div>
            <table border="1" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th>
                        Product Name
                    </th>
                    <th>
                        Unit Price
                    </th>
                    <th>
                        Units in Stock
                    </th>
                </tr>
            </thead>
            <tbody id="products" class="sys-template">
                <tr sys:command="select">
                    <td>
                        {{ ProductName }}
                    </td>
                    <td>
                        { binding UnitPrice }
                    </td>
                    <td>
                        {{ UnitsInStock }}
                    </td>
                </tr>
            </tbody>
        </table>
        <br /><br />
        <div id="details" class="sys-template">
            <fieldset>
                <legend>Product Details</legend>
                <label for="productNameText">
                    Product Name:</label>
                <input id="productNameText" sys:value="{{ ProductName }}" />
                <br />
                <label for="unitPriceText">
                    Unit Price:</label>
                <input id="unitPriceText" sys:value="{ binding UnitPrice }" />
                <br />
                <label for="inStockText">
                    Units in Stock:</label>
                <input id="inStockText" sys:value="{{ UnitsInStock }}" />
                <br />
            </fieldset>
        </div>
            </div>
        </form>
    </body>

    2011年7月14日 5:15

答案

全部回复