We downloaded the telerik toolkit trial and then downloaded MVC VSExtentions for VS 2017 but we didnt find the add new scaffolding item. would you please help?
12 Answers, 1 is accepted
Could you try to install the extensions manually from wrappers\aspnetmvc\Scaffolding. The entire process is described in the following documentation article:
https://docs.telerik.com/aspnet-mvc/getting-started/scaffolding
Regards,
Nencho
Progress Telerik
folder scaffolding not exist under C:\Program Files (x86)\Progress\Telerik UI for ASP.NET MVC R3 2017\wrappers\aspnetmvc
Please excuse my mistake, as I missed the fact that you are using VS2017. I am afraid that at the time being, the Scaffolding is not supported with the version of the Visual Studio. This is also the reason why, when the installator is ran, we check for the VS version and if there is only 2017 instance, the Scaffolding folder is never deployed.
Regards,
Nencho
Progress Telerik
Yes, the issue had been fixed - you should be able to scaffold items in VS2017 with our latest official release as well.
Regards,
Nencho
Progress Telerik
I am afraid that we are not aware of such an issue. Could you clarify, if you are able to track that the EF model cannot return any data, or the data is there, but the never rendered in the widget? Also, can you try adding new ADO service to mimic the same that the scaffolding functionality does, but manually? This way we can scope the issue to not correct model creation and investigate the issue deeper.
Regards,
Nencho
Progress Telerik
Nencho,
Thank you for your response. I will explain:
I have setup a working ADO.NET Entity Data Model and as a part of it I am connecting to a table called UPCI_DistrictLookup. Here is the file that was generated by that:
namespace UPCIkuiApps.Models
{
using System;
using System.Collections.Generic;
public partial class UPCI_DistrictLookup
{
public long RecordId { get; set; }
public long District { get; set; }
public string Country { get; set; }
public string State { get; set; }
public string ZipPostal { get; set; }
}
}
I know this entity data model returns results because if I create the scaffolding item using "Add Scaffold", "MVC 5 Controller with views, using Entity Framework" and I select the model class created by the data entity model class called UPCI_DistrictLookup and have it generate the controller and views for me, they work. Here is the working controller:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using UPCIkuiApps.Models;
namespace UPCIkuiApps.Controllers
{
public class UPCI_DistrictLookupWorkingController : Controller
{
private SE_PRODEntities db = new SE_PRODEntities();
// GET: UPCI_DistrictLookupWorking
public ActionResult Index()
{
return View(db.UPCI_DistrictLookup.ToList());
}
// GET: UPCI_DistrictLookupWorking/Details/5
public ActionResult Details(long? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
UPCI_DistrictLookup uPCI_DistrictLookup = db.UPCI_DistrictLookup.Find(id);
if (uPCI_DistrictLookup == null)
{
return HttpNotFound();
}
return View(uPCI_DistrictLookup);
}
// GET: UPCI_DistrictLookupWorking/Create
public ActionResult Create()
{
return View();
}
// POST: UPCI_DistrictLookupWorking/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "RecordId,District,Country,State,ZipPostal")] UPCI_DistrictLookup uPCI_DistrictLookup)
{
if (ModelState.IsValid)
{
db.UPCI_DistrictLookup.Add(uPCI_DistrictLookup);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(uPCI_DistrictLookup);
}
// GET: UPCI_DistrictLookupWorking/Edit/5
public ActionResult Edit(long? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
UPCI_DistrictLookup uPCI_DistrictLookup = db.UPCI_DistrictLookup.Find(id);
if (uPCI_DistrictLookup == null)
{
return HttpNotFound();
}
return View(uPCI_DistrictLookup);
}
// POST: UPCI_DistrictLookupWorking/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include = "RecordId,District,Country,State,ZipPostal")] UPCI_DistrictLookup uPCI_DistrictLookup)
{
if (ModelState.IsValid)
{
db.Entry(uPCI_DistrictLookup).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(uPCI_DistrictLookup);
}
// GET: UPCI_DistrictLookupWorking/Delete/5
public ActionResult Delete(long? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
UPCI_DistrictLookup uPCI_DistrictLookup = db.UPCI_DistrictLookup.Find(id);
if (uPCI_DistrictLookup == null)
{
return HttpNotFound();
}
return View(uPCI_DistrictLookup);
}
// POST: UPCI_DistrictLookupWorking/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(long id)
{
UPCI_DistrictLookup uPCI_DistrictLookup = db.UPCI_DistrictLookup.Find(id);
db.UPCI_DistrictLookup.Remove(uPCI_DistrictLookup);
db.SaveChanges();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
}
}
And here is the working view:
@model IEnumerable<UPCIkuiApps.Models.UPCI_DistrictLookup>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Country)
</th>
<th>
@Html.DisplayNameFor(model => model.State)
</th>
<th>
@Html.DisplayNameFor(model => model.ZipPostal)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Country)
</td>
<td>
@Html.DisplayFor(modelItem => item.State)
</td>
<td>
@Html.DisplayFor(modelItem => item.ZipPostal)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
</table>
Then, when I do the same thing using the Kendo UI scaffolding. It creates this controller:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using UPCIkuiApps.Models;
namespace UPCIkuiApps.Controllers
{
public class UDistLookupController : Controller
{
private SE_PRODEntities db = new SE_PRODEntities();
public ActionResult Index()
{
return View();
}
public ActionResult UPCI_DistrictLookup_Read([DataSourceRequest]DataSourceRequest request)
{
IQueryable<UPCI_DistrictLookup> upci_districtlookup = db.UPCI_DistrictLookup;
DataSourceResult result = upci_districtlookup.ToDataSourceResult(request, uPCI_DistrictLookup => new {
RecordId = uPCI_DistrictLookup.RecordId,
Country = uPCI_DistrictLookup.Country,
State = uPCI_DistrictLookup.State,
ZipPostal = uPCI_DistrictLookup.ZipPostal
});
return Json(result);
}
protected override void Dispose(bool disposing)
{
db.Dispose();
base.Dispose(disposing);
}
}
}
And it creates this view which does return the column headers, but nothing shows in the data.
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
height: 400,
columns: [
{field: "Country"},
{field: "State"},
{field: "ZipPostal"}
],
dataSource: {
type: "aspnetmvc-ajax",
transport: {
read: {
url: "UPCI_DistrictLookup_Read"
}
},
schema: {
data: "Data",
model: {
id: "RecordId",
fields: {
RecordId: { type: "number"},
District: { type: "number"},
Country: { type: "string"},
State: { type: "string"},
ZipPostal: { type: "string"}
}
}
},
serverPaging: true,
serverSorting: true,
serverSorting: true,
},
scrollable: true
})
</script>
Thank you for your help.
Thank you for the detail information and code snippet provided.
I tried to follow the instructions and a schema, close to the one demonstrated below (for underlying data), but I am still unable to replicate the described issue - the objects are correctly generated and data is properly loaded.
That said, I would like to ask you to submit a new support thread, along with your project attached, which we can use for local test purposes and pin down the reason for the issue.
Thank you in advance for your cooperation.
Regards,
Nencho
Progress Telerik
I have informed the colleague, who is assisting you in the other thread and passed the information discussed in this one. Please continue the correspondence in the other thread, in order to avoid any duplication and confusion.
Thank you in advance!
Regards,
Nencho
Progress Telerik