2016-04-11 26 views
0

Gönder düğmesini tıklattığımda, 404 hatası alıyorum, sayfa bulunamıyor.Sayfa, açısal kılavuz ve asp.mvc kullanarak gönder 404 hatası döndürüyor

Sql Server veritabanından bir pdfs listesi döndürmek için ASP.MVC ile köşeli-ui-grid kullanıyorum. Sayfanın ilk yüklemesinde, ızgara tüm pdfs'lerle doldurulur ve sayfalara ayrılır. Sayfasına bazı giriş alanları ekledim, böylece ilk yükten sonra, ad ve tarih aralığına göre arama yapabilirsiniz. Düğmeye tıklandığında, sayfa 404 hatası döndürür, bulunamıyor.

Görünüm

@model WSCWebsite.Models.SC_Opinions_Search_Result 

@using (Html.BeginForm("Opinions", "Home", FormMethod.Post, new {@class = "form-horizontal", @id = "searchForm"})) 
{ 
<p>Enter search information into one or more of the fields below.</p> 

<p>Using more than one field will result in a more narrow search.</p> 

<p>Opinions and orders published prior to 2006 are not available in this search.</p> 
<div class="well" ng-controller="OpinionDefaultData"> 
    <div class="form-group"> 
     <label class="control-label col-sm-3">Start Date</label> 
     <div class="col-sm-5"> 
      <input type="text" ng-model="StartDate" class="datefield" /> 
      <span style="padding: 0 0 0 3px">example: 2/27/2006</span> 
     </div> 
    </div> 

    <div class="form-group"> 
     <label class="control-label col-sm-3">End Date</label> 
     <div class="col-sm-5"> 

      <input type="text" ng-model="EndDate" class="datefield" /> 
      <span style="padding: 0 0 0 3px">example: 12/27/2014</span> 
     </div> 
    </div> 

    <div class="form-group"> 
     <label class="control-label col-sm-3">Appellant</label> 
     <div class="col-sm-5"> 
      <input type="text" ng-model="Appellant" /> 
     </div> 
    </div> 

    <div class="form-group"> 
     <label class="control-label col-sm-3">Appellee</label> 
     <div class="col-sm-5"> 
      <input type="text" ng-model="Appellee" /> 
     </div> 
    </div> 

    @*<div class="form-group"> 
      <label class="control-label col-sm-3">Docket Number</label> 
      <div class="col-sm-5"> 
      <div> 
       @Html.TextBoxFor(m => m.DocketNumber, new { @class = "form-control", @style="display:inline-block; width:220px" }) 
       <span style="padding: 0 0 0 3px">example: 12/27/2014</span> 
      </div> 
      </div> 
     </div>*@ 

    <div class="form-group"> 
     <div class="col-sm-4"></div> 
     <div class="col-sm-2"> 
      <input type="button" value="Clear Form" onclick="history.go(0)" class="btn btn-primary" /> 
     </div> 
     <div class="col-sm-2"> 
      <button ng-click="SearchOpinions()" class="btn btn-primary">Search</button> 
     </div> 

    </div> 
</div> 

MVC denetleyicisi

[HttpGet] 
    public JsonResult GetOpinions(DateTime? StartDate, DateTime? EndDate, string Appellant, string Appellee, string DocketNumber) 
    { 
     if (EndDate != null) 
     { 
      EndDate = EndDate.Value.AddHours(23); 
     } 
     OpinionEntities dbContext = new WSCWebsite.Models.OpinionEntities(); 
     var lst = dbContext.SC_Opinions_Search(DocketNumber,Appellant, Appellee, StartDate, EndDate, 200).ToList(); 

     return Json(lst, JsonRequestBehavior.AllowGet); 
    } 

Eğik Kontrolör

var app = angular.module('WSCWebSite', ['angularUtils.directives.dirPagination']); 

app.controller("OpinionDefaultData", function ($scope, $http) { 

$scope.StartDate = ""; 
$scope.EndDate = ""; 
$scope.Appellant = ""; 
$scope.Appellee = ""; 
$scope.DocketNumber = ""; 

$scope.SearchOpinions = function() { 
    $scope.Opinions = []; //declare an empty array 
    $http.get("/Home/GetOpinions", { 
     params: { 
      StartDate: $scope.StartDate, 
      EndDate: $scope.EndDate, 
      Appellant: $scope.Appellant, 
      Appellee: $scope.Appellee, 
      DocketNumber: $scope.DocketNumber 
     } 
    }).success(function (response) { 
     $scope.Opinions = response; 
    }); 
    } 
}); 

app.controller('OpinionData', function ($scope, $http) { 
    $scope.Opinions = []; //declare an empty array 
    $http.get("/Home/GetOpinions", { 
     params: { 
      StartDate: $scope.StartDate 
      , EndDate: $scope.EndDate 
      , Appellant: $scope.Appellant 
      , Appellee: $scope.Appellee 
      , DocketNumber: $scope.DocketNumber 
     } 
    }).success(function (response) { 
     $scope.Opinions = response; //ajax request to fetch data into $scope.data 
    }); 
}); 
+0

Are ..

@using (Html.BeginForm("Opinions", "Home", FormMethod.Post, new {@class = "form-horizontal", @id = "searchForm"})) { } 

buraya bak İşlem olarak, Görüşler geçti ancak işlem adı GetOpinions() Üzerinde

bakmak, belki de size yardımcı olacaktır, burada herhangi bir Hatalar orada yayınlıyor F12'de mi? Ayrıca, gönderdiğinizde kontrol cihazınız çarpıyor mu? (Denetleyicilerin post yöntemine bir ara nokta koyun ve onu vurup vurmadığını görün) :) –

cevap

2

formunuz

+0

Html.BeginForm uzantısını kaldırdım ve sadece html

etiketiyle değiştirdim. Verileri MVC denetleyicisine geri döndü görebiliyorum, ancak Görünüm döndürülen pdfs listesini göstermek için ferahlatıcı değil. – Drew

+0

belki de küçük bir sorun var, bana doğru verileri ver .. – Bharat

+0

Bharat, bence bu küçük bir şey doğru. Hangi "uygun veriler" size sağlayabilirim? – Drew