2013-02-08 14 views
8

Ich Klicken auf die Schaltfläche wird der folgende Fehler „Laufzeitfehler Microsoft JScript: Objekt unterstützt keine Eigenschaft oder Methode‚live‘“ angezeigt wird Meine Ansicht Seite ist wie folgt:Microsoft JScript-Laufzeitfehler: Objekt unterstützt keine Eigenschaft oder Methode '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

'live()' wurde in jQuery 1.9 entfernt. Ist das die Version, die du benutzt? –

+1

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

+0

[Live wurde ab 1.9 entfernt] (http://jquery.com/upgrade-guide/1.9/#) live-removed) –

Antwort

15

Sie benutze jquery neustes (1.9 ...) in dem $(sel).live(...) veraltet wurde daher deine Fehlermeldung.

1) Zurück zu einer älteren Version von Jquery.

2) aktualisieren Sie Ihren Code (ersetzen Sie Live durch).

3) jquery-latest zurückstellen.

+0

Danke Mikakun ... ich arbeite – Raja

6

Sie können auch in wie jQuery Migrate mit Upgrade auf jQuery 1.9

2

ich nur über diese helfen aussehen lief nach mir zu jQuery 1.9 zu aktualisieren. Ich stelle jedoch fest, dass keiner der Benutzer (außer AliRıza Adıyahşi in einem Link ohne Erklärung) zuvor darauf hingewiesen hat, welcher Teil des Codes den Fehler verursacht hat. Immerhin, wenn $(sel).live(...) war veraltet zugunsten $(sel).on(...) dann ist es eine ziemlich einfache Lösung, oder?

Das Problem ist, dass diese Fehler innerhalb jquery.unobtrusive-ajax.js geworfen wird, die Sie als Teil des Bündels sind in @Scripts.Render("~/bundles/jqueryval")

Da Sie nicht die Ajax Form oder abbrechen verwenden, wird der Fehler unwahrscheinlich, etwas zu beeinflussen ist (es ist nicht auf meiner), aber ich konnte nichts von Microsoft auf eine Lösung finden. Das Problem besteht leider darin, dass Sie Ihre Version von jquery.unobtrusive-ajax.js, die die .live-Aufrufe durch .on() ersetzt, reparieren, bis MS den offiziellen Fehler behoben hat.

+1

danke Elsimer ... es funktioniert – Raja

+0

danke an alle .. – Raja

Verwandte Themen