The documentation found here has some formatting issues that makes it quite hard to read. Look at the IndexController.cs tab:
https://demos.telerik.com/aspnet-core/grid/index
Also, by convention the file name should be the same as the class name. Therefore, the tab should be renamed as GridController.cs
I stepped through this process because my Grid would not show up. After the process... it still wouldn't show up:
https://docs.telerik.com/aspnet-core/getting-started/getting-started-copy-client-resources
So, then I used the Telerik Extension to create a project. After reviewing the template I see that pretty much nothing in this start up instruction is there. I the article obsolete? If so, please update it.
i already install telerik
and by nuget from commercial download link
but still got problem
do you have any idea?
thank you
Hi,
Ok, so I have a grid, strangely enough called "grid". On it I have .Editable(e => e.Mode(GridEditMode.InCell) set. Everything works great. My data annotations do their job and catch errors. However, one of the columns has a unique index on it. I catch duplicate errors in a try/catch block on the server when they hit save. I add a Model error, but nothing is displayed.
The error message never shows. What am I missing?
Thanks … Ed
@(Html.Kendo().Grid<
RoomsModel.RoomModel
>()
.Name("grid")
.ToolBar(t =>
{
t.Create().Text("Add New"); t.Save().Text("Save Changes");
})
.HtmlAttributes(new { style = "height: 650px;" })
.Editable(e => e.Mode(GridEditMode.InCell) //.TemplateName("RoomEditTemplate")
.Window(w => w.Title("Room").Width(650)))
.Columns(columns =>
{
columns.Bound(t => t.Id).Visible(false);
if (((IEnumerable<
Property
>)ViewData["Properties"]).Count() > 1)
{
columns.ForeignKey(t => t.PropertyId, (System.Collections.IEnumerable)ViewData["Properties"],
"Id", "PropertyName").Width(125);
}
columns.Bound(c => c.RoomNumber).Title("Room Number").Width(125);
columns.Bound(c => c.RoomName).Title("Room Name").Width(120);
columns.Command(command =>
{
//command.Edit().Text("Edit/View Details");
command.Destroy();
}).Width(150);
})
.HtmlAttributes(new { style = "margin-left:3px" })
.Resizable(resize => resize.Columns(true))
.Selectable(s => s.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.Scrollable()
.Filterable()
.Sortable()
.Pageable() //p => { p.PageSizes(true); })
.DataSource(ds =>
ds.Ajax()
.Batch(true)
.Events(ev => ev.Error("errorHandler"))
.Read(r => r.Url("?handler=RoomsRead").Data("forgeryToken"))
.Update(u => u.Url("?handler=RoomsUpdate").Data("forgeryToken"))
.Create(c => c.Url("?handler=RoomsCreate").Data("forgeryToken"))
.Model(m =>
{
m.Id(t => t.Id);//.Editable(false);
})
.PageSize(10)
)
)
public IActionResult OnPostRoomsCreate([DataSourceRequest] DataSourceRequest request,
[Bind(Prefix = "models")]IEnumerable<
RoomsModel.RoomModel
> Rooms)
{
Room rm;
List<
RoomModel
> lstResults = new List<
RoomModel
>();
if (ModelState.IsValid)
{
try
{
using (TransactionScope oScope = new TransactionScope())
{
if (Rooms != null && ModelState.IsValid)
{
foreach (var r in Rooms)
{
rm = new Room();
rm.RoomName = r.RoomName;
.
.
.
_db.Rooms.Add(rm);
_db.SaveChanges();
RoomModel rmm = new RoomModel();
rmm.Id = rm.Id;
.
.
.
lstResults.Add(rmm);
}
}
oScope.Complete();
}
}
catch (Exception ex)
{
var sqlException = ex.InnerException as SqlException;
if (sqlException != null && sqlException.Errors.OfType<
SqlError
>()
.Any(se => se.Number == 2601 || se.Number == 2627 /* PK/UKC violation */))
{
StatusMessage = "Error: Room number already used.";
ModelState.AddModelError("RoomNumber", StatusMessage);
return new JsonResult(new[] { lstResults.ToDataSourceResult(request, ModelState) });
}
}
}
return new JsonResult(new[] { lstResults.ToDataSourceResult(request, ModelState) });
}
I am building a dashboard application where the Arc Gauge's value will be updated periodically.
Multiple Arc Gauges are added as item in ListView.
While CenterTemplate can be bound to a model (see OEE property in OEEDataModel), it appears that i can't do the same for Arc Gauge's Value property.
How can i update each Arc Gauge's Value property in the ListView when the OEE value changes?
index.cshtml
@{
ViewData["Title"] = "Dashboard";
}
@model VelaMfgDashboard.Models.Dashboard.DashboardModel;
<
div
class
=
"dashboard-section k-content wide"
>
<
h1
>Dashboard: @Model.ProductionLine</
h1
>
<
div
class
=
"dashboard-table"
>
<
h2
class
=
"title"
>OEE</
h2
>
<
div
class
=
"data"
>
@(Html.Kendo().ListView(Model.OEEDatas)
.Name("oeeListView")
.TagName("div")
.ClientTemplateId("oee-template")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.ServerOperation(false) // all data will be requested at once and data operations will be applied client-side
.Read(read => read.Action("OEEDatas_Read", "Dashboard")))
.Pageable(pageable => pageable
.Refresh(true)
.ButtonCount(5)
.PageSizes(new[] { 5, 15, 30 })
)
)
</
div
>
</
div
>
</
div
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"oee-template"
>
<
div
class
=
"oee-container"
k-widget>
<
dl
>
<
dt
>Machine #:MachineNo#</
dt
>
<
dd
>
@(Html.Kendo().ArcGauge()
.Name("oeeGauge")
.Value(80)
.Scale(x => x.Min(0).Max(100))
.CenterTemplate("#:OEE#%")
.ToClientTemplate()
)
</
dd
>
</
dl
>
</
div
>
</
script
>
public class DashboardModel
{
public string ProductionLine { get; set; }
public List<
OEEDataModel
> OEEDatas { get; set; }
public DashboardModel()
{
OEEDatas = new List<
OEEDataModel
>();
}
}
public class OEEDataModel
{
public double OEE { get; set; }
public int MachineNo { get; set; }
}
I have a grid with inline set to true.
my bound data is decorated with [UIHint("Integer")].
Everything is working great, the user clicks on the cell and teh numerictextbox comes up … left aligned.
How to right align this thing?
I have the column right aligned via htmlattributes, but that has no effect on the numeric textbox.
Thanks … Ed
Hello,
I have a kendo grid that contains child grid(s) that get created by using the "ClientDetailTemplateId". I want to be able to edit the rows in the child grid via a PopUp editor. The problem is that when I use HtmlHelper or TagHelper tags such as (@(Html.Kendo().NumericTexBoxFor(model => model.column).... or 'kendo-numerictextbox .../>), Validation span tags such as (<span asp-validation-for="TextBox" class="text-danger"></span>), or any sort of JavaScript within <script> tags, in my editor's template file I get an error that the template is not formed correctly.
Also, if my model has a "Range" attribute such as "[Range(0, long.MaxValue, ErrorMessage = "Value must be positive")]", the numeric text box HTML helper causes the same error that the template is not formed correctly.
I realize that within templates JavaScript has a different notation such as #if(a=b){# ... #}#. However this type of notation doesn't work either. For example, I would like to include the following JavaScript code under my kendo numeric text box so that when the user clicks inside the box the value within gets selected, but this code causes an error.
<script>
$(
"#TextBox"
).focus(
function
() {
var
input = $(
this
);
setTimeout(
function
() {
input.select();
});
});
</script>
I don't know what I'm doing wrong, and I can't find the right documentation that would describe how to get something like this scenario to work. Any help is appreciated. Thanks.
Shawn A.
Example task "Task_A" and task "Task_B" are linked by the dependency "Finish to Start" (FS).
https://docs.telerik.com/devtools/aspnet-ajax/controls/gantt/server-side-programming/objects/dependencies
1. Your control can execute the following script:
- if the "end date" of the task "Task_A" changes, does the "start date" of the task "Task_B" change?
Your control can execute the following script:
- if the "end date" of the task "Task_A" changes, does the "start date" of the task "Task_B" change?
I tried to do it in the demo version. But, if I did everything right, then it does not work for me.
https://demos.telerik.com/aspnet-ajax/gantt/examples/overview/defaultcs.aspx
2. Do you have a different web control(Gantt) that can solve the problem of p. 2?
(ASP.NET AJAX, ASP.NET MVC, Blazor, PHP, JSP, Silverlight)
hi ,
I am going to add a kendo Menu to my existing ASP.NET Core 2.2 MVC app.
Two questions come to mind :
1.Do I add the menu to _Layout.cshtml ?
2.how to security trimming . I'm using Azure Active directory (example controller decoration [Authorize(Policy = "CanAccessAdminGroup")]
Any examples ?
Thanks alot in advance,
Peter
I'm trying to implement the example I'm seeing here: https://demos.telerik.com/aspnet-core/autocomplete/serverfiltering. My code is identical to what is provided in the example.
When using the demo on this page, I see the URLs like this (I'm pulling these from developer tools in the browser):
https://demos.telerik.com/aspnet-core/Home/GetProducts?text=test&filter%5Bfilters%5D%5B0%5D%5Bvalue%5D=test&filter%5Bfilters%5D%5B0%5D%5Boperator%5D=contains&filter%5Bfilters%5D%5B0%5D%5Bfield%5D=ProductName&filter%5Bfilters%5D%5B0%5D%5BignoreCase%5D=true&filter%5Blogic%5D=and
The key I want to point out here is that "text=test" is passed on the querystring to my backend page.
However, when I do this in my development environment, no "text" key is passed, I do however have all the filter keys being passed.
Am I doing something wrong? My code is literally the same as in the example.
Thanks!