Telerik Forums
UI for ASP.NET Core Forum
1 answer
250 views

I've created a spreadsheet in a View that is somewhat complex. The first 10 rows are frozen and function as an informational header to the data which is in rows 11 and greater. The header has merged cells and labels for data. For example, it's a time card spreadsheet and row 1 has just the employee name with the label for the name just to the left of it. I am assuming I can't use a datasource because the spreadsheet is not a simple column/row display of data. What is the best practice to load a spreadsheet like this with data read from the database?

Marin Bratanov
Telerik team
 answered on 15 Feb 2019
1 answer
197 views

I use Entity Framework Core 2.2.  It does me a solid by constructing the entire hierarchy from the database without me asking it to.  That said, your TreeList actually binds to a Flat structure.  Your model definition then defines how the hierarchy is built.

Do you have an example of how you use EF with your TreeList?  Do you have tools or a method that I could use to convert what I get from EF over to what your control needs?

I have a self-referencing Group table:

  • Id
  • ParentId
  • Name
  • Description

ParentId references Id

@(Html.Kendo().TreeList<GsiPortal.Models.Group>()
    .Name("treelist")
    .Columns(columns =>
    {
        columns.Add().Command(c => { c.Custom().Text("Details").Name("detailButton").Click("toDetails"); }).Width(120);
        columns.Add().Field(e => e.Name).Width(220).TemplateId("icon-template");
        columns.Add().Field(e => e.Description).Width(220);
        columns.Add().Command(c => { c.Custom().Text("Create").Name("createButton").Click("toCreate"); }).Width(120);
    })
    .Selectable(selectable => selectable.Mode(TreeListSelectionMode.Single))
    .DataSource(dataSource => dataSource
        .ServerOperation(false)
        .Read(read => read.Action("IndexJson", "Groups").Data("readParams"))
        .Model(m =>
        {
            m.Id(f => f.Id);
            m.ParentId(f => f.ParentId);
            m.Expanded(true);
            m.Field(f => f.Name);
            m.Field(f => f.Description);
        }
    )
    .Events(events =>
    {
        events.Error("onError");
    })
    ))
 
    <script>
        var groupId = Number(@(ViewBag.GroupId));
 
        function readParams() {
            return { id: groupId };
        }
 
        function toDetails(e) {
            e.preventDefault();
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
 
            if (dataItem != null) {
                window.location.href = '@Url.Action("Details", "Groups")/' + dataItem.Id;
            }
        }
 
        function toCreate(e) {
            e.preventDefault();
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
 
            if (dataItem != null) {
                window.location.href = '@Url.Action("Create", "Groups")/?parentId=' + dataItem.Id;
            }
        }
 
        function onError(e) {
            alert(e.toString());
        }
 
 
    </script>
Preslav
Telerik team
 answered on 15 Feb 2019
1 answer
146 views

I have the following grid.  However, I was given the requirement that we shouldn't have the search exposed full time.  We should only display it when we have more than 1 page worth of data.  How do I accomplish this?

@using Portal.Configuration
@using Portal.Models
 
@{
    ViewData["Title"] = "Customers";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
<h2>Customers</h2>
 
<p>
    <a asp-action="Create">Create New</a>
</p>
<div class="row">
    <div class="col-xs-18 col-md-12">
        @(Html.Kendo().Grid<Customer>()
                      .Name("grid")
                      .Columns(columns =>
                      {
                          columns.Command(command => command
                              .Custom("Detail")
                              .Click("goDetail"))
                              .Width(Glossary.ButtonWidth);
                          columns.Bound(p => p.Name)
                              .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
                                  .ShowOperators(false)
                                  .SuggestionOperator(FilterType.Contains)));
                          columns.Bound(p => p.ProfileId)
                              .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
                                  .ShowOperators(false)
                                  .SuggestionOperator(FilterType.Contains)));
                          columns.Bound(p => p.DatabaseStatus.Name).Title("Database Status")
                              .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
                                  .ShowOperators(false)
                                  .SuggestionOperator(FilterType.Contains)));
                          columns.Bound(p => p.AddTimestamp).Format("{0:MM/dd/yyyy}");
                      })
                      .Pageable()
                      .Sortable()
                      .Scrollable()
                      .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
                      .HtmlAttributes(new { style = "height:550px;" })
                      .DataSource(dataSource => dataSource
                          .Ajax()
                          .PageSize(20)
                          .Read(read => read.Action("IndexJson", "Customers"))
                      )
        )
 
        <script type="text/javascript">
 
            function goDetail(e) {
                e.preventDefault();
                var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
                window.location.href = '@Url.Action("Details", "Customers")/' + dataItem.Id;
            }
 
            function error_handler(e) {
                if (e.errors) {
                    var message = "Errors:\n";
                    $.each(e.errors,
                        function (key, value) {
                            if ('errors' in value) {
                                $.each(value.errors,
                                    function () {
                                        message += this + "\n";
                                    });
                            }
                        });
                    alert(message);
                }
            }
        </script>
    </div>
</div>
Georgi
Telerik team
 answered on 15 Feb 2019
2 answers
1.3K+ views

Hi,

I have a treeview and I want to bind hierarchical data. 

Country

State

Offices in State

I want to make call to the controller and get the data based on the node that is being expanded. To get the right data I want send the parameter of the currently selected node (Id, level) so that I can get the appropriate data to expand. 

 @(Html.Kendo().TreeView()
              .Name("exampleTreeView")
              .LoadOnDemand(true)
              .Checkboxes(checkboxes => checkboxes
                  .Name("checkbox")
                  .CheckChildren(true)
              )
              .Events(events => events
                  .Check("onCheck")
              )
              .DataTextField("Name")
              .DataSource(dataSource => dataSource
                  .Model(model=>model.Id("Value").HasChildren("HasChildren"))
                  .Read(read => read.Action("GetData", "MyController"))
              )
              )

Right now I can get the first set of data from getdata method and bind it. want to expand a nde which will call the same action method with some additional data to get the right data. 

I have two questions - 

1. (How) can I attach or bind additional property (level which could be country,state or office)

2. How can I pass this value to the GetData Action to get the right data.

Abinash
Top achievements
Rank 1
 answered on 14 Feb 2019
1 answer
616 views

 Does combobox/dropdowns come with client side filtering built in?  Should one use comboboxes and not dropdowns for this?

Thnks.

Marin Bratanov
Telerik team
 answered on 14 Feb 2019
1 answer
141 views

Am considering use of server side filtering and paging for combobox because expecting large number of dropdown values.

What would be  the recommended number of values count for which the use of server side filering/paging is recommended?  When would one start seeing performance issues with large number of dropdown values?

Thnks.

Marin Bratanov
Telerik team
 answered on 14 Feb 2019
2 answers
66 views

Your link returns a "not found" error:

 

https://demos.telerik.com/aspnet-core/tabstrip/events

 

Alex Hajigeorgieva
Telerik team
 answered on 14 Feb 2019
3 answers
393 views

Is there a guide for creating a Asp.Net core application on Mac OS X using kendo.ui for asp.net core ?

Or just using OS Windows and IDE VisualStudio ? 

Ianko
Telerik team
 answered on 14 Feb 2019
15 answers
309 views
Hello,
I'm new to Telerik and I'm trying to run your Scheduler demo for Core in my Visual Studio 2017. I installed Telerik.UI.for.AspNet.Core(2019.1.115) in my VS 2016.
But when I copy the code from your demo I get an error in: @(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()

Under Kendo.Mvc.Examples it cannot find "Models". Did the dll changed? How can I get to Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel ?
Marin Bratanov
Telerik team
 answered on 13 Feb 2019
4 answers
1.6K+ views
I am using a DateTime column with filterable options enabled. When I apply a filter on this column, the request.Filters has a valid DateTime but it is applying an incompatible format when it calls SQL Server. Here is my code:

    public async Task<JsonResult> OnGetDataAsync([DataSourceRequest]DataSourceRequest request, CustomFilterModel customFilters)
    {
        IQueryable<DAL.Product> products = this.productService.GetByCriteria(customFilters);

        JsonSerializerSettings jsonSettings = new JsonSerializerSettings()
        {
            ContractResolver = new DefaultContractResolver()
        };

        return new JsonResult(await products.ToDataSourceResultAsync(request), jsonSettings);
    }

This is what EF generates: (abbreviated for clarity)

    SELECT ....
    WHERE [p].[DateAdded] <= '2018-10-01T00:00:00.0000000'

**Error:** System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting date and/or time from character string.

Basically, the generated SQL query does not work when I run it directly in SMMS. It only works if I convert the date to **'2018-10-01T00:00:00'**

Tech stack: .NET Core 2.2, Razor Pages, Kendo 2018.3.911, SQL 2018
Paito
Top achievements
Rank 2
 answered on 13 Feb 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?