Using this Grid with the Groups command button definition, I want to navigate to another MVC Action passing a CustomerId value as a parameter. I have an Event handler (with no JavaScript) but am not sure if this is the right approach. Should this be some type of HTML call? If JavaScript is the right way to do this then please supply some code.
This is for ASP.NET Core. Thanks in advance for your help, Joel.
@(Html.Kendo().Grid<
GsiPortal.Models.Customer
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Name);
columns.Bound(p => p.DisplayName).Title("Display Name");
columns.Bound(p => p.AddTimestamp).Format("{0:MM/dd/yyyy}");
columns.Command(command => command.Custom("Groups").Click("goGroups"));
columns.Command(command => command.Edit()).MinResizableWidth(75);
columns.Command(command => command.Destroy()).MinResizableWidth(75);
})
.Editable(editable => editable.Mode(GridEditMode.InLine)) //.TemplateName("CustomerEdit")) //Turn on the inline cell editing by setting
.Pageable()
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.PersistSelection(true)
.Navigatable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Id).Editable(false);
model.Field(p => p.AddTimestamp).Editable(false);
})
.Read("IndexJson", "Customers")
.Update("Edit", "Customers")
.Create("CreateJson", "Customers")
.Destroy("DeleteJson", "Customers")
))
How do I pass field data from the master grid to the detail grid in the modal popup editor in kendo ui mvc? And how do I do the opposite?
Thanks,
James
I need a TreeView example for ASP.NET Core 2.2 that uses Binding and shows me how I can capture the drag/drop events from the control with some context information. Your example shows that it can be done but I see no way to capture the data item that is bound to the node or even wire up a KeyValue to a node so when it is clicked that I have a breadcrumb back to my data store.
I appreciate your help,
Joel
My current TreeView:
Html.Kendo().TreeView()
.TemplateId("treeview-template")
.DragAndDrop(true)
.Name("kendoTreeView")
.Events(events => events
.Change("onChange")
.Select("onSelect")
.Drop("onDrop")
.DragEnd("onDragEnd")
)
.BindTo(Model, (NavigationBindingFactory<
TreeViewItem
> mappings) =>
{
mappings.For<
Group
>(binding => binding.ItemDataBound((item, group) =>
{
item.Text = group.Name;
item.Id = $"{group.Id}";
item.ImageUrl = group.ImageUrl;
item.Expanded = true;
})
.Children(group => group.Children));
})
)
<
script
>
var treeview;
function onSelect(e) {
alert(e.node);
}
function onChange(e) {
alert(e.node);
}
function onDrop(e) {
alert(e.node);
}
function onDragEnd(e) {
alert(e.node);
}
$(document).ready(function() {
treeview = $("#treeview").data("kendoTreeView");
});
</
script
>
I have a multiselect setup as an Editor Template utilized by the grids popup editor, the control loads properly, displays the data, allows me to select multiple Order Types, but then returns null to my model every time when I save the changes on the popup editor.
How do I wire up the value of the MultiSelect to my model when it is an Editor Template for a Grid Popup?
Here is my Editor Template code:
@model IEnumerable<
int
>
@(Html.Kendo().MultiSelect()
.Name("OrderTypeIDs")
.DataTextField("Description")
.DataValueField("OrderTypeID")
.DataSource(d => d
.Ajax()
.Read(r => r
.Action("OrderTypes_Read", "Locations")
.Data("GetSelectedClientID")))
.TagMode(MultiSelectTagMode.Multiple)
.Value(Model)
)
Here is the underlying model class:
public class LocationsModel : INotifyPropertyChanged
{
public LocationsModel() : base()
{
}
[ScaffoldColumn(false)]
public decimal LocationId { get; set; }
[ScaffoldColumn(false)]
public string ClientID { get; set; }
[DisplayName("Code")]
[Required]
public string LocationCode { get; set; }
[Required]
public string Name { get; set; }
[DisplayName("Address 1")]
[Required]
public string Address1 { get; set; }
private string address2;
[DisplayName("Address 2")]
public string Address2
{
get => address2 ?? "";
set => address2 = value ?? "";
}
[Required]
public string City { get; set; }
[Required]
public string State { get; set; }
[Required]
public string Country { get; set; }
[DisplayName("Zip Code")]
[Required]
public string ZipCode { get; set; }
[DisplayName("Phone")]
[Required]
public string PhoneNumber { get; set; }
[UIHint("OrderTypeIDs")]
[DisplayName("Allowed Order Types")]
public IEnumerable<
int
> OrderTypeIDs { get; set; }
[DisplayName("# of O Types")]
[ReadOnly(true)]
public int OrderTypeCount => OrderTypeIDs?.Count() ?? 0;
[ScaffoldColumn(false)]
public string CreatedBy { get; set; }
[ScaffoldColumn(false)]
public DateTime CreatedOn { get; set; }
[ScaffoldColumn(false)]
public string LastUpdatedBy { get; set; }
[ScaffoldColumn(false)]
public DateTime LastUpdatedOn { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
Does anyone have an example of an EditorTemplate for a Grid that handles a BitMask field?
Thanks
M
Hi,
could you help me about following calculations in the grid for telerik asp.net core (C#)
IN - OUT = SALDO (for row index 0)
IN - OUT = SALDO (for row index 1) + SALDO from previous row
image example attached
My grid only show max 20 row
It does not matter if paging is disabled
<kendo-grid name="grdAfdeling" selectable="true" on-change="onChangeAfdeling" deferred="true">
<datasource server-operation="false" type="DataSourceTagHelperType.Ajax">
<transport>
<read url="/Medarbejder/Hent_Medarbejder_Afdeling" data="hentAfdID" />
</transport>
</datasource>
<scrollable enabled="false" />
<columns>
<column field="ID" hidden="true" />
<column field="Navn" title="Navn" />
<column field="Lokalnr" title="Lokalnr." width="80" />
<column field="Mobilnet" title="Mobil Lokalnr." width="90" />
<column field="Mobilnr" title="Mobilnr." />
<column field="Email" title="Email" />
@if (User.IsInRole("w_Paaroerende"))
{
<column field="Familie" title="Familie" encoded="false" />
}
<column field="BilledUrl" title="Billed" template="<img src='#= BilledUrl #' alt='image' width='70' />" />
</columns>
</kendo-grid>
I using VS 2017 15.9.3 + asp.net core + mcv ( + razor )
created the project with telerik Project Asp.net core + Grid selection.and created 3 times with the sass theme generator a template and replaced in
_Layout.cshtml the stylesheet
<environment names="Development"> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" /> <!--link rel="stylesheet" href="~/css/site.css" /--> <link rel="stylesheet" href="~/css/all.css" /> </environment> <environment names="Staging,Production"> <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" /> <!--link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" /--> <link rel="stylesheet" href="~/css/all.css" asp-append-version="true" /> </environment>
but anyhow the Grid looks ugly in the footer any time.
i found this blog https://www.telerik.com/blogs/getting-started-telerik-ui-for-asp-net-core-and-bootstrap-4
but i do not understand how to do the update
>>No matter how you choose to manage your dependencies, the default layout (i.e _Layout.cshtml
)
should contain references to them. The default layout >>defines a top
level template for views in your web application. These references
include the following:
where to store the references , where to reference them etc..
it´s a little bit confusing me so please is there some better help tan this how to update or maybe it´s not needed anyhow to solve the grid ui problem ?
thanks br thomas
I am having some strange issue with cascading binding.
This code here does work:
<
kendo-dropdownlist
name
=
"Countries"
bind-to
=
"@(new SelectList(Model.Countries,"
Id","CountryName"))"></
kendo-dropdownlist
>
@(Html.Kendo().DropDownList()
.Name("DocumentTypes")
.DataTextField("Name")
.DataValueField("Id")
.BindTo(Model.GovIdTypes)
.CascadeFrom("Countries")
.CascadeFromField("IssuingCountry.Id")
)
But this one does not:
<
kendo-dropdownlist
name
=
"Countries"
bind-to
=
"@(new SelectList(Model.Countries,"
Id","CountryName"))"></
kendo-dropdownlist
>
<
kendo-dropdownlist
name
=
"DocumentTypes"
bind-to
=
"@(new SelectList(Model.GovIdTypes,"
Id","Name"))"
cascade-from
=
"Countries"
cascade-from-field
=
"IssuingCountry.Id"
></
kendo-dropdownlist
>
I don't know why I cannot se the tag helper here.
The first dropdown I got to work with tag helper but the second one not.
As you have read the title. I want to add a variable in my title. When I put a property in my model, and also define the model in my div. It still gives me the error:
The name 'property' does not exist in the current. But when I add series for example I can do Model => Model.propname Why is it not possible to do this? sTotalCount is in Model2
The code:
@model model1
<
div
class
=
"demo-section k-content wide"
>
@(Html.Kendo().Chart<
App.Model2
>()
.Name("test" + Model1.ID)
.Title(sTotalcount + "this is the total")