2013-02-08 21 views
8

私は次のエラーがの「Microsoft JScriptのランタイムエラー:オブジェクトは、 『ライブ』プロパティまたはメソッドをサポートしていません」と表示されるボタンをクリックしています 次のように私のビューページは次のとおりです。Microsoft JScript実行時エラー:オブジェクトがプロパティまたはメソッド 'live'をサポートしていませんか?

@model Charis.Models.Products 
@{ 
    ViewBag.Title = "Create"; 
    Layout = "~/Views/Shared/_Layout.cshtml"; 
} 
<link href="../../Content/CharisSite.css" rel="stylesheet" type="text/css" /> 
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> 
@using (Html.BeginForm("Create", "Prod", FormMethod.Post, new { enctype = "multipart/form-data" })) 
{ 
    @Html.ValidationSummary(true) 
    <table><tr><td> 
    <table> 
    <tr> 
    <td> 
    <fieldset> 
      <legend>Products</legend> 

    <table> 
     <tr> 
     <td> 
      <div class="editor-label"> 
      @Html.LabelFor(model => model.Productname) 
      </div> 
     </td> 
     <td> 
      <div class="editor-field"> 
      @Html.EditorFor(model => model.Productname) 
      @Html.ValidationMessageFor(model => model.Productname) 
      </div> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <div class="editor-label"> 
       @Html.LabelFor(model => model.ProductPrice) 
      </div> 
     </td> 
     <td> 
      <div class="editor-field"> 
      @Html.EditorFor(model => model.ProductPrice) 
      @Html.ValidationMessageFor(model => model.ProductPrice) 
      </div> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <div class="editor-label"> 
      @Html.LabelFor(model => model.ProductDiscount) 
      </div> 
     </td> 
     <td> 
      <div class="editor-field"> 
      @Html.EditorFor(model => model.ProductDiscount) 
      @Html.ValidationMessageFor(model => model.ProductDiscount) 
      </div> 
     </td> 
     </tr> 

     <tr> 
     <td> 
      <div class="editor-label"> 
       @Html.LabelFor(model => model.LanguageType) 
      </div> 
     </td> 
     <td> 
      <div class="editor-field"> 
      @Html.EditorFor(model => model.LanguageType) 
      @Html.ValidationMessageFor(model => model.LanguageType) 
      </div> 
     </td> 
     </tr> 

     <tr> 
     <td> 
      <div class="editor-label"> 
       @Html.LabelFor(model => model.ReleaseDate) 
      </div> 
     </td> 
     <td> 
       <div class="editor-field"> 
         @Html.EditorFor(model => model.ReleaseDate) 
         @Html.ValidationMessageFor(model => model.ReleaseDate) 
       </div> 
     </td> 
     </tr> 
     <tr> 
     <td> 
      <div class="editor-label"> 

       <label for="file">Upload Image:</label> 
      </div> 
     </td> 
     <td> 
       <div class="editor-field"> 
        <input type="file" name="file" id="file"/> 
       </div> 
     </td> 
     </tr> 

    </table> 

    </fieldset> 
    </td> 
    <td></td></tr> 
    </table> 

    </td></tr> 
    <tr><td> 



    <table> 
    <tr> 
    <td> 
     <fieldset> 
     <legend>Details</legend> 
      <table> 
       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.AlbumDescription1) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.AlbumDescription1) 
          @Html.ValidationMessageFor(model => model.AlbumDescription1) 
         </div> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.AlbumDescription2) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.AlbumDescription2) 
          @Html.ValidationMessageFor(model => model.AlbumDescription2) 
         </div> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.Cast) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.Cast) 
          @Html.ValidationMessageFor(model => model.Cast) 
         </div> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.DirectedBy) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.DirectedBy) 
          @Html.ValidationMessageFor(model => model.DirectedBy) 
         </div> 
        </td> 
       </tr> 
       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.ProducedBy) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.ProducedBy) 
          @Html.ValidationMessageFor(model => model.ProducedBy) 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          <label for="file">Upload Image1:</label> 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          <input type="file" name="file1" id="file1"/> 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          <label for="file">Upload Image2:</label> 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          <input type="file" name="file2" id="file2"/> 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          <label for="file">Upload Image3:</label> 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          <input type="file" name="file3" id="file3"/> 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          <label for="file">Upload Image4:</label> 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          <input type="file" name="file4" id="file4"/> 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          <label for="file">Upload Image5:</label> 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          <input type="file" name="file5" id="file5"/> 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.NoOfDisk) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.NoOfDisk) 
          @Html.ValidationMessageFor(model => model.NoOfDisk) 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.Weight) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.Weight) 
          @Html.ValidationMessageFor(model => model.Weight) 
         </div> 
        </td> 
       </tr> 

       <tr> 
        <td> 
         <div class="editor-label"> 
          @Html.LabelFor(model => model.Format) 
         </div> 
        </td> 
        <td> 
         <div class="editor-field"> 
          @Html.EditorFor(model => model.Format) 
          @Html.ValidationMessageFor(model => model.Format) 
         </div> 
        </td> 
       </tr> 

      </table> 
     </fieldset> 
    </td> 
    </tr> 
    </table> 



    </td></tr> 

    <tr><td> 
     <table><tr><td><fieldset><table> 
      <tr> 
       <td> 
       <p> 
        <input type="submit" value="Create" /> 
        <input type="button" value="Clear" id="btnClear" /> 
       </p> 
       </td> 
      </tr> 
     </table></fieldset></td></tr></table> 

    </td></tr> 

    </table> 

} 

@*<div> 
    @Html.ActionLink("Back to List", "Index") 
</div> 
*@ 
@section Scripts { 
    @Scripts.Render("~/bundles/jqueryval") 
} 

@if (TempData["notice"] != null) 
{ 
<p style="color:Red;" >@TempData["notice"]</p> 
} 
+3

jQuery 1.9で 'live()'が削除されました。それは使用しているバージョンですか? –

+1

http://stackoverflow.com/questions/14593724/jquery-1-9-0-live-function –

+0

[ライブは1.9で削除されました](http://jquery.com/upgrade-guide/1.9/#ライブ削除) –

答えて

15

を使用すると、最新のjquery(1.9 ...)を使用しています。そのため、$(sel).live(...)は推奨されなくなりました。

1)jqueryの古いバージョンに戻します。

2)あなたのコードを更新します(オンでライブを置き換えます)。

3)put back jquery-latest。

+0

ありがとうMikakun ...私は働いています – Raja

6

また、私はjQueryの1.9に自分自身を更新した後、この全体に走ったのjQuery 1.9に

2

のアップグレードを支援するためにjQueryの移行を含めに見ることができます。しかし、私は、(AliRızaAdıyahşiを除いて、説明のないリンクの)ユーザーの誰も、あなたのコードのどの部分がエラーを引き起こしているかを先に指摘していないことに気付きました。結局のところ、 $(sel).live(...)の方が、$(sel).on(...)の方が推奨されなくなりました。あなたはAjaxのフォームを使用するか、キャンセルされていないので

問題が@Scripts.Render("~/bundles/jqueryval")

にあなたがバンドルの一部として含まれ、このエラーがjquery.unobtrusive-ajax.js内部でスローされていることで、エラーは何も影響を与えることはほとんどありません(それは私のものではありませんが)私はMicrosoftから何かを見つけることができませんでした。残念ながら、残念ながら、jquery.unobtrusive-ajax.jsのバージョンを修正して、MSが公式のものを修正するまで.live呼び出しを.on()に置き換えることがあります。

+1

ありがとうElsimer ...それは働いています – Raja

+0

すべてに感謝.. – Raja

関連する問題