2014-04-10 50 views
0

我試圖從JQuery UI滑塊widget和Asp.net mvc 5中從SQL服務器表中獲取數據。我試圖在Web上找到示例。任何人都知道任何好的資源?任何使用JQuery UI滑塊和Asp.net mvc訪問數據庫值的示例?

@model XXXX.Evaluator.Data.EntityModel.EvaluationQuestion 

@{ 
    ViewBag.Title = "Index"; 
} 

<h2>Index</h2> 

<div class="container"> 

    <div class="panel panel-default"> 
     @Html.LabelFor(model => model.QuestionsText) 

     <div class="panel-body"> 
      @if (@Model.ResponseType.Description == "Number") 
      { 
       <p> 
        <label for="amount">Selected Value:</label> 
        <input type="text" id="hidden" style="border:0; color:#f6931f; font-weight:bold;"> 
       </p> 

       <div id="[email protected](Model.ID)"></div> 
      } 
      @*else if (@Model.ResponseType.Description == "Text") 
      { 
       /* Insert text box for the user to type in their response. */ 
       <input type="text" multiple /> 
      } 
      else if (@Model.ResponseType.Description == "Percentage") 
      { 
       /* Insert slider or text box for user to indicate percentage. */ 
      }*@ 


     </div> 
    </div> 

</div> 

<script> 
    $(document).ready(function() { 
     $("#[email protected](Model.ID)").slider({ 
      value: 0, 
      min: 0, 
      max: 10, 
      step: 1, 
      slide: function (event, ui) { 
       $("#[email protected](Model.ID)").val(ui.value); 
      } 
     }); 
    }); 
</script> 

我正在找到未找到對象的實例。

+0

你究竟在哪裏得到異常? – Fals

+0

@ Html.LabelFor(model => model.QuestionsText) – Tharnid

+0

我想通了 – Tharnid

回答

0

我想通了。我沒有從上一頁調用正確的模型和會話變量。