Telerik Forums
UI for ASP.NET Core Forum
2 answers
224 views

Hi,

In the absence of a dedicated spot for map questions I'll just post my question here:

If we look at the example code take from here:

@(Html.Kendo().Map().Name("map").Center(30.268107, -97.744821).Zoom(15).Layers(layers =>{         layers.Add().Type(MapLayerType.Tile).UrlTemplate("http://tile2.opencyclemap.org/transport/#= zoom #/#= x #/#= y #.png").Subdomains("a", "b", "c").Attribution("&copy; <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>." +"Tiles courtesy of <a href='http://www.opencyclemap.org/'>Andy Allan</a>");         layers.Add().Type(MapLayerType.Marker).DataSource(dataSource => dataSource
                  .Read(read => read.Action("_StoreLocations", "Map"))).LocationField("LatLng").TitleField("Name");}))

 

My question is this - in the scenario of using Core Razor Pages we do not have a Controller Action as such.

Could I please if it is possible have a modified sample like the one above except to show using data-source using the new Razor Pages model?

Thanks for your time,

John

John
Top achievements
Rank 1
 answered on 19 Dec 2017
1 answer
306 views

Hi,

we have a problem with filtering when grid column is binded to the complex type.

Below you can find the makup for the problematic column and DataSource:

columns.Bound(m => m.PaymentMethod.Name).Title("Payment Method").Width(100)
               .Filterable(filterable => filterable.Operators(operators => operators.ForString(str => str.Clear().Contains("contains").IsEqualTo("equals"))));

.DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(true)
        .PageSize(20)
        .Model(model =>
        {
            model.Id(id => id.IdPayment);
            model.Field(m => m.PaymentMethod).DefaultValue(new PaymentMethodViewModel());
            model.Field(m => m.PaymentStatus).DefaultValue(new PaymentStatusViewModel());
        })
        .Read(read => read.Action("Read", "Payments"))
        .Create(create => create.Action("Create", "Payments"))
        .Update(update => update.Action("Update", "Payments"))
        .Destroy(destroy => destroy.Action("Delete", "Payments"))
    )

When we filter for the first time everything works OK, the correct set of data is returned.

But something breaks the filter button. When we clik the filter button for the second time, filter menu window doesn't show up and there is a JS error in console:

 

Błąd mapy źródła: TypeError: this.worker is null
URL zasobu: null
URL mapy źródła: null
[Więcej informacji]
Error: Syntax error, unrecognized expression: [data-field=PaymentMethod.Name]

 

Does Grid for Asp.Net Core supports filtering on complex types?

Stefan
Telerik team
 answered on 19 Dec 2017
5 answers
789 views

Hello,

If I change the value of a field which is grouped in the grid (Popup Edit) and save it, the grid does not reflect the changed row in the correct group...

to use grid.refresh() doesn't help - is it necessary to Reload the grid in such a case?

robert

Stefan
Telerik team
 answered on 18 Dec 2017
1 answer
632 views

While running the demo at http://demos.telerik.com/aspnet-core/multiselect/serverfiltering I noticed that the MultiSelect is passing filter query string parameters.

For example, searching for chef sends the following parameters:

text: chef
filter[filters][0][value]: chef
filter[filters][0][field]: ProductName
filter[filters][0][operator]: startswith
filter[filters][0][ignoreCase]: true
filter[logic]: and

However the example ignores the filter parameters and implements a contains filter in the controller:

public JsonResult GetProducts(string text)
{
    products = products.Where(p => p.ProductName.Contains(text));

 }


Can the filter parameters be bound to a model? Is there an existing Telerik filter model class that can be used?
Dimitar
Telerik team
 answered on 15 Dec 2017
17 answers
1.3K+ views

The attached image shows the error for a aspnetcore 2.0 project targeting 461 trying to do server side filtering on a grid, you will get a 500.

public ActionResult CustomerRead([DataSourceRequest] DataSourceRequest request)

{

}

 

Anyone else running into this issue?

Bozhidar
Telerik team
 answered on 15 Dec 2017
3 answers
345 views
I have a kendo grid as below :

@(Html.Kendo().Grid(Model)
              .ToolBar(toolbar =>
              {
                  toolbar.Create().Text("Add attachment");
                  toolbar.Save().SaveText("Save").CancelText("Cancel");
              })
              .Name("AttachmentsGrid")
              .Columns(columns =>
              {
                  columns.Bound(p => p.Id).Title("ID").Width(20);
                  columns.Bound(p => p.AttachmentType).Title("Type").Width(100).EditorTemplateName("AttachmentTypeDropDown").ClientTemplate("#:AttachmentType#");
                  columns.Bound(p => p.AttachmentPath).Title("Attachments").Width(200).EditorTemplateName("UploadAttachments")
                      .ClientTemplate("<a href='" + Url.Action("DownloadAttachment", "Utility", new { fileName = "#=AttachmentPath#" }) + "'/>" + "#=AttachmentName#" +"</a>");
                  columns.Bound(p => p.LastModifiedBy).Title("Uploaded By").Width(100);
                  columns.Bound(p => p.LastModifiedAt).Title("Uploaded On").Format("{0:dd-MMM-yyyy}").Width(100);

                  columns.Command(command => command.Destroy().Text(" "));
              }))

The column AttachmentPath has a ClientTemplate which allows the user to download the file on click of it.
I have added an Editor Template also which displays Kendo Upload for allowing the user to browse the file for upload.

On click of the column , the download works successfully.
But after that it does not show the hyperlink – it is just displayed as simple text.

If the user wants to download again, the column needs to be sorted or the grid needs to be refreshed
How can I resolve this issue?
Stefan
Telerik team
 answered on 14 Dec 2017
3 answers
428 views

Hello,

I have multiple MultiSelectFor in my view with the same Ajax Datasource - now I want to use the Html.Kendo().DataSource for all of this

MultiSelectFor but it seems this is not possible - is it only possible to use Html.Kendo().DataSource with Grid and Autocomplete like in the sample?

how to share a datasource with multiple MultiSelectFor or FropDownFor?

(I don't want to have multiple requests)

robert

Dimitar
Telerik team
 answered on 13 Dec 2017
3 answers
311 views

Hello,

I want to set a NumericTexbox to work with integer numbers without decimals, but using taghelper didn't work.

This code block shows the number with 2 decimals:
<kendo-numerictextbox for="Id" spinners="false" decimals="0" format="#"/>

But if I use this code block, it works as expected:
@Html.Kendo().NumericTextBoxFor(model => model.Id).Format("#").Decimals(0).Spinners(false)

Thanks

Konstantin Dikov
Telerik team
 answered on 13 Dec 2017
1 answer
529 views

 @(Html.Kendo().Grid<SysRoleModel>
        ()
        .HtmlAttributes("") 
        .AutoBind(true)
        .Name("grid")
        .Selectable(selectable =>//Grid选中设置
        {
            selectable.Enabled(true);//是否可以选中
            selectable.Type(GridSelectionType.Row);//选中行还是单元格;Row为行模式;Incell为单元格模式
            selectable.Mode(GridSelectionMode.Multiple);//选中一行还是可以选中多行;Single为单选;Multiple为多选
        })
        .Columns(columns =>
        {

            columns.Template("<input class=\"box\" id=\"assignChkBx\" name=\"assignChkBx\" title=\"#=RoleName#\" CompanyRole=\"#=CompanyRole#\" type=\"checkbox\" value=\"#=Id#\" onclick=\"selectRow(this)\"/> ")
            .Width(50)
            .ClientHeaderTemplate("<input class=\"selectAll\" type=\"checkbox\" id=\"allBox\" onclick=\"selectAllRow(this)\" /></text>")
            .HeaderHtmlAttributes(new { style = "text-align: center" })
            .HtmlAttributes(new { style = "text-align: center" });
            columns.Bound(c => c.RoleName).Title("角色名称").Width(150).HeaderHtmlAttributes(new { style = "text-align: center" });
            columns.Bound(c => c.RoleDescription).Title("角色说明").Width(150).HeaderHtmlAttributes(new { style = "text-align: center" });
            columns.Bound(c => c.Remark).Title("备注").Width(117).HeaderHtmlAttributes(new { style = "text-align: center" });
            columns.Bound(c => c.Enabled).Title("是否有效").Width(117).HeaderHtmlAttributes(new { style = "text-align: center" }).ClientTemplate("#if(Enabled=='1'){#" +
                                              "<span>是</span>" +
                                          "#}else {#" +
                                              "<span>否</span>" +
                                         "#}#").HtmlAttributes(new { style = "text-align: center" });
            columns.Bound(c => c.CompanyRole).Title("系统角色").Width(117).HeaderHtmlAttributes(new { style = "text-align: center" }).ClientTemplate("#if(CompanyRole=='1'){#" +
                                                     "<span>是</span>" +
                                                 "#}else {#" +
                                                     "<span>否</span>" +
                                                "#}#").HtmlAttributes(new { style = "text-align: center" });
            columns.Bound(c => c.InDate).Title("录入时间").Width(126).HeaderHtmlAttributes(new { style = "text-align: center" }).Format("{0:yyyy-MM-dd HH:mm:ss}");
        })
        .Pageable(page => page
        .Refresh(true)
        .ButtonCount(10)
        .PageSizes(new[] { 20, 30, 50 })
        .Messages(mess => mess.ItemsPerPage("每页显示数目").Display("显示{0}-{1}条,共{2}条"))
        )//分页设置
        .Sortable()  // 是否支持排序
        .Scrollable(c => c.Height("100%"))
        .HtmlAttributes(new { @class = "k-grid-autoheight" })
        .Events(c => c.DataBound("window.kendoGridAutoHeightDataBound"))
        .PersistSelection()
        .Reorderable(reorderable => reorderable.Columns(true))//是否支持列的拖拽
        .Resizable(resizable => resizable.Columns(true))//设置Grid是否可以手动调整列宽
        .ColumnMenu()
        .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .ServerOperation(true)
                    .Model(model => model.Id(p => p.Id))
                    .Read(read => read.Action("Role_Read", "Role").Data("GetCriteria"))
        )
)

 

Scrollable Properties set 100% Why does not work, I want to make the grid control automatically according to the interface height how to set

 

Stefan
Telerik team
 answered on 08 Dec 2017
5 answers
562 views

Hi,

I am wondering if it possible to change the text from whatever the viewmodel properties are in the column headers to something custom after the spreadsheet has read from the datasource.

For example, I have a viewmodel with properties "SundayOne", "MondayOne" etc but I would like to dynamically change the value in the spreadsheet cell from "SundayOne" to a specific date like "Nov 12th" depending on what data items get loaded after the read event to make it more user friendly.

However when I attempt to change the value of the cell after the read the changes don't take effect.

I have attached a picture of the cells I am trying to edit in case it is unclear.

Thanks.

Veselin Tsvetanov
Telerik team
 answered on 07 Dec 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?