1

マスターページが添付されたaspxページでjqueryスライダーを使用しているときに、次のようなエラーが発生します

 The state information is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.

そして私のコードは

<div class="demo">
    <input type="text" class="sliderValue"  />
        <p>
        </p>
        <div id="slider"></div>
    </div>

<script language="javascript">
        $("#slider").slider({
            range: "min",
            value: 1,
            step: 10,
            min: 0,
            max: 1000,
            slide: function (event, ui) {
                $("input").val(ui.value);
            }
        });


        $("input.sliderValue").change(function (event) {
            var value1 = parseFloat($("input").val());
            var highVal = value1 * 2;
            $("#slider").slider("option", { "max": highVal, "value": value1 });
        });
    </script>

なにか提案を??

編集:しかし、このコードは別のaspxページで正常に機能しています.この背後にある理由を知っているかもしれません

  <div>
  <input type="text" class="sliderValue" data-index="0" value="10" runat="server" />
  <input type="text" class="sliderValue" data-index="1" value="90" runat="server" />
  </div>
  <br />
  <div id="slider">
  </div>

<script language="javascript">
        $(document).ready(function () {
            $("#slider").slider({
                min: 0,
                max: 100,
                step: 1,
                range: true,
                values: [10, 90],
                slide: function (event, ui) {
                    for (var i = 0; i < ui.values.length; ++i) {
                        $("input.sliderValue[data-index=" + i + "]").val(ui.values[i]);
                    }
                }
            });

            $("input.sliderValue").change(function () {
                var $this = $(this);
                $("#slider").slider("values", $this.data("index"), $this.val());
            });
        });

    </script>
4

2 に答える 2

0

これを使用してください、これがあなたに役立つことを願っています

  1. エラーを生成したファイルの先頭に「Debug=true」ディレクティブを追加します。例:
 <%@ Page Language="C#" Debug="true" %>

また:

2) アプリケーションの構成ファイルに次のセクションを追加します。

<configuration>    <system.web>
     <compilation debug="true"/>    </system.web> </configuration>

私はあなたのコードを使用しましたが、あなたが言ったようなエラーは発生しませんでした.

ここに画像の説明を入力

于 2012-02-29T12:30:45.333 に答える
0

コードをラップしてみてください$(document).ready(function(){});

<script language="javascript">

$(document).ready(function(){

        $("#slider").slider({
            range: "min",
            value: 1,
            step: 10,
            min: 0,
            max: 1000,
            slide: function (event, ui) {
                $("input").val(ui.value);
            }
        });


        $("input.sliderValue").change(function (event) {
            var value1 = parseFloat($("input").val());
            var highVal = value1 * 2;
            $("#slider").slider("option", { "max": highVal, "value": value1 });
        });

});
    </script>
于 2012-02-29T10:09:28.423 に答える