I thought I had a pretty good example of the code, but I guess I'll delve deeper...
On the Pecos Controller I have Index.cshtml and PecosSearchResults.cshtml. On the Index view I have a form that is basically a search form. At the bottom of the Index.cshtml, I have @Html.Partial("PecosSearchResults"). Both views use the model PecosViewModel.
In that model, I have the following:
using
System.Collections.Generic;
using
oandp_redesign_wip.Models.Database;
namespace
oandp_redesign_wip.Models.ViewModels
{
public
class
PecosViewModel
{
public
string
SearchTerm {
get
;
set
; }
public
List<vNPISearch> vNPISearchResults {
get
;
set
; }
}
}
In the vNPISearch model, I have the following:
namespace
oandp_redesign_wip.Models.Database
{
public
class
vNPISearch
{
public
string
NPI {
get
;
set
; }
public
string
ProviderFirstName {
get
;
set
; }
public
string
ProviderLastName {
get
;
set
; }
public
string
OrganizationName {
get
;
set
; }
public
string
ProviderBusinessLocationAddressCity {
get
;
set
; }
public
string
ProviderBusinessLocationAddressState {
get
;
set
; }
public
string
PecosNPI {
get
;
set
; }
public
string
PecosPendingReviewNPI {
get
;
set
; }
}
}
Alright, so when the page initially loads, it returns an empty List<vNPISearch>. After pressing the Search, it calls a Post that looks like:
[HttpPost]
public
ActionResult Index(PecosViewModel pecosViewModel)
{
var searchTerm = pecosViewModel.SearchTerm;
pecosViewModel.vNPISearchResults =
new
List<vNPISearch>();
pecosViewModel.vNPISearchResults.AddRange(oandpService.GetPecosSearchResults(searchTerm));
return
View(pecosViewModel);
}
On the partial view, PecosSearchResults.cshtml, I have an incredibly simple table that has a foreach (var item in Model.vNPISearchResults) and it basically creates rows for each item. So, I know results are being returned.
However, I also have the following:
@(Html.Kendo().Grid<
vNPISearch
>()
.Name("npi-grid")
.DataSource(dataSource => dataSource
.Server()
.Read(read => read.Action("NPI_Read", "Pecos")))
.Columns(columns =>
{
columns.Bound(x => x.ProviderFirstName).Title("First Name");
})
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)
In the controller, I have the following:
public
ActionResult NPI_Read([DataSourceRequest] DataSourceRequest request)
{
return
Json(oandpService.GetPecosSearchResults(SearchTerm).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
The Grid appears, but is completely blank. I went with using the CDN for the CSS & Javascript pages, and there's still no formatting of the grid. See the attached file. Up top I have the Telerik Grid and after "No items to display" is the table which clearly has results. In the Grid, if I click on the "First Name" header it takes me to a page that has the information it should display but it's just a plain page with JSON data (data isn't in any View or Layout pages).
Oh, so this is how the bottom of the Layout & Subpage Layout looks:
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
<script src="http://kendo.cdn.telerik.com/<kendo ui version>/js/kendo.all.min.js"></script>
<script src="http://kendo.cdn.telerik.com/<kendo ui version>/js/kendo.aspnetmvc.min.js"></script>
@RenderSection("scripts", required: false)
</html>
And within the head tag, I have the following:
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/<kendo ui version>/styles/kendo.common-bootstrap.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/<kendo ui version>/styles/kendo.bootstrap.min.css" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
Is that enough detail for you? I'd really appreciate a prompt response as we're in trial. I truly love Telerik and KendoUI as I've used the Telerik WebForms controls in the past. However, if I can't figure this out I'm gonna start looking at other tools.