Telerik Forums
UI for ASP.NET MVC Forum
3 answers
76 views

Hi,

unfortunately after upgrading to the latest Version my application has serveral errors. The reason seems to be a bug in server-filtering.

Try

https://demos.telerik.com/aspnet-mvc/grid/serverbinding

Filter column product ID = 1 => It works

Then filter column product ID = 1 OR product ID = 2 => Error

The internal error is a NullReferenceException (see attach file).

Not so good...

Bye, Michael

 

Pavlina
Telerik team
 answered on 26 Oct 2017
2 answers
494 views

I have the Column Menu on my grid to allow users to lock some columns.  However, when I use the columnMenu the filter option shows with the arrow next to it but the sub menu for the filter does not show at all.  Any idea what I am doing wrong? I am using version 2017.3.913.

Here is my grid code:

@model IEnumerable<Saturn.Models.ListData>
<div class="BordRSolThin">
@(Html.Kendo().Grid(Model)
.Name(componentName: "EditGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(actionName: "EditGrid_Read", controllerName: "List")
.Data("getEditData"))
.PageSize(pageSize: 500)
)
.Columns(columns =>
{
columns.Command(command => command.Custom(name: "Edit").Click(handler: "editRevision")).Width(pixelWidth: 75).Locked(true).Lockable(false);
columns.Bound(p => p.CoreID).Title(text: "CoreID").Width(pixelWidth: 100);
columns.Bound(p => p.ProjID).Title(text: "ProjID").Width(pixelWidth: 100);
columns.Bound(p => p.ListRev).Title(text: "ListRev").Width(pixelWidth: 100);
columns.Bound(p => p.SYSID).Title(text: "SYSID").Width(pixelWidth: 100).Locked(true).Lockable(true);
columns.Bound(p => p.FGrp).Title(text: "FGrp").Width(pixelWidth: 300);
columns.Bound(p => p.REDUND).Title(text: "REDUND").Width(pixelWidth: 100);
columns.Bound(p => p.NAME).Title(text: "NAME").Width(pixelWidth: 550).Lockable(true);
columns.Bound(p => p.PlanName).Title(text: "PlanName").Width(pixelWidth: 250).Lockable(true);
columns.Bound(p => p.BarrelType).Title(text: "BarrelType").Width(pixelWidth: 100).Lockable(true);
columns.Bound(p => p.TickNo).Title(text: "TickNo").Width(pixelWidth: 100);                                
                            })
.Pageable(pageable => pageable
.Input(enabled: true)
.Numeric(enabled: false)
.Refresh(enabled: true)
)
.Sortable()
.ColumnMenu()
.Scrollable(scr => scr.Height(pixelHeight: 700))
.Selectable()
.Filterable()
)
</div>

 

 

 

Richard
Top achievements
Rank 1
 answered on 25 Oct 2017
1 answer
290 views

I am creating a Kendo grid with a datetime column. I want to group the date column so that it is descending. The latest date is on top and the earliest on the bottom. I have come across this line of code

groups => groups.AddDescending(true)

 

But it says that there is no definition for AddDescending. How do I change the grouping? Here is how my grid is defined.

@(Html.Kendo().Grid<LogModel>()
            .Name("Log")
            .Columns(columns =>
            {
                columns.Bound(m => m.dateTimeChangeDate)
                    .Title("Date and Time")
                    .ClientTemplate("#= ChangeDate#")
                    .ClientGroupHeaderTemplate("#= formatUtcDateToLocal(value,  'MM/DD/YYYY')#")
                    .Width("12%");
                columns.Bound(m => m.Component)
                    .Title("Component")
                    .Width("8%")
                    .Filterable(filterable => filterable
                        .UI("componentFilter")
                        .Extra(false)
                        .Operators(operators => operators
                            .ForString(str => str.Clear()
                            .Contains("Contains")
                         ))
                );
                columns.Bound(m => m.Action)
                    .Title("Action")
                    .Width("15%")
                    .Filterable(filterable => filterable
                        .UI("actionFilter")
                        .Extra(false)
                        .Operators(operators => operators
                            .ForString(str => str.Clear()
                            .Contains("Contains")
                        ))
                     );
                columns.Bound(m => m.Changer)
                    .Title("Changer")
                    .Width("10%");
                columns.Bound(m => m.Identifier)
                    .Title("On")
                    .Width("15%");
                columns.Bound(m => m.OldValue)
                    .Title("Old Value")
                    .Width("20%");
                columns.Bound(m => m.NewValue)
                    .Title("New Value")
                    .Width("20%");
            })
            .Filterable()
            .Selectable()
            .Sortable()
            .Groupable()
            .Resizable(resize => resize.Columns(true))
            .ToolBar(toolbar =>
            {
            toolbar.Template(
                @<text>
                    <a class="k-button k-button-icontext k-grid-excel" href="#"><span class="k-icon k-i-excel"></span>Export to Excel</a>
                    <span style='padding-left:35%;font-weight:bold;padding-top:7px'>@ViewBag.ProjectNumber</span>
                    <span style='float:right;font-weight:bold;padding-top:7px'>Total: <span id="change-log-record-count">@ViewBag.ChangeLogRecordAmount</span> records</span>
 
                </text>
                );
            })
            .Excel(excel => excel.AllPages(true).FileName(@ViewBag.ChangeLogType + " Change Log " + @ViewBag.ProjectNumber + ".xlsx").Filterable(true))
            .DataSource(dataSource => dataSource
                 .Ajax()
                 .Model(model =>
                 {
                     model.Id(p => p.Id);
                 })
                 .Read(read => read.Action("FetchChangeLogData", "ChangeLog")
                 .Data("buildParam"))
           )
           .Events(e => e.FilterMenuInit("resizeFilter")
                         .ExcelExport("modifyFormatForExcel")
                         .DataBound("preselectCustomFilter"))
           .ClientDetailTemplateId("change-log-details-template")
    )
Stefan
Telerik team
 answered on 25 Oct 2017
3 answers
457 views

How can we select the node that is clicked on by a right click event?  I am trying to pass the selected node's id on a context menu select event but unless the user left clicks on the node to select it first, the last selected node information gets sent, if one was even selected.

This may be fairly basic, but I can't find any examples of this.

Thanks.

Neli
Telerik team
 answered on 25 Oct 2017
3 answers
493 views

Hi Telerik,

 

I want to know how to add a TreeView inside DropDownList with MVC like your demo in ASP.NET AJAX http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/treeviewcombobox/defaultcs.aspx?product=treeview

 

Can you please help me to resolve this issue?
Thanks

Ivan Danchev
Telerik team
 answered on 24 Oct 2017
1 answer
592 views

I have a tabstrip that loads its content from partial views, and this works well provided the routeValues never change. For example:

@(Html.Kendo().TabStrip()
    .Name("MyTabStrip")
    .Items(i =>
    {
        i.Add().Text("First Tab").LoadContentFrom("FirstAction", "MyController", new { id = ViewData["id"]  });
        i.Add().Text("Second Tab").LoadContentFrom("SecondAction", "MyController", new { id = ViewData["id"] });
    })
)

This will hit FirstAction and SecondAction when the tabs are selected, and carry the id along from ViewData, this is fine.

...but if "id" is a more dynamic bit of data, that needs to change on the page, this approach is no longer valid.  

The TabStrips do not have any Data function, akin to what can be found in the Read attribute in a regular DataSource, which would have been nice, and there is nothing too helpful in the Select event of the TabStrip. I have tried editing the _contentUrls list inside the TabStrip element, but this does not seem to work, either; it seems this is populated when the element is created, but not actually used.

...so how can this be done? Is there any way to update the content urls of an existing tab?

Ivan Danchev
Telerik team
 answered on 24 Oct 2017
8 answers
460 views
Hi, 

Can Grid Hierarchy handle Batch Edit?
Kindly provide sample codes if there is..

Thanks..
Konstantin Dikov
Telerik team
 answered on 23 Oct 2017
1 answer
1.2K+ views

I need to add a horizontal scrollbar at the top of the kendo grid. I've attached a screenshot of what I'd like to be able to do.

 

Thanks

Stefan
Telerik team
 answered on 23 Oct 2017
3 answers
377 views

I have this autocomplete in my application.

@(Html.Kendo().AutoComplete()

  .Name("Name")

  .Placeholder("Please select something...")

  .Delay(300)

  .MinLength(2)

  .DataTextField("Field")        

  .DataSource(source => source

    .Read(read => read

      .Action("SomeAction", "SomeController")

      .Data("SomeData"))

    .ServerFiltering(true))

  .Events(x => x

    .Select("onSelect")           

    .DataBound("onDataBound ")

    .Change("onChange "))

)

It retrieves elements from a table that match a certain condition. On select, in the backend, I change that condition and add the selected element to a grid, which means that that element will not show up in the autocomplete from now on.

@(Html.Kendo().Grid<ViewModel>()
.Name(
"Name")
.Deferred()
.ClientRowTemplate(Html.Partial(
"RowTemplate").ToHtmlString())
.TableHtmlAttributes(
new { @class = "table table-stripped" })
.Events(e => e.Change(
"onChange").DataBound("onDataBound"))
.Resizable(res => res.Columns(
true))
.Columns(columns =>

  {

    columns.Bound(e => e.Code);

     columns.Bound(e => e.Title);

  })

.Filterable()

.Sortable()

.Selectable()

.Pageable(x =>

  {

    x.ButtonCount(3);

    x.Enabled(true);

    x.PageSizes(new[] { "10", "20", "30" });

    x.Refresh(true);

  })

.DataSource(dataSource => dataSource

  .Ajax()

  .Read(read => read.Action("SomeAction", " SomeController "))

  .ServerOperation(true)
))


When I select it in the grid, it restores the condition, which means that element can show up in the autocomplete results again.

This works fine. The problem is that once I change the condition for an element, if I do the same search again, the read action won’t be called, so I won’t get modified elements from the table.

For example, if I do a search on “Doc”, I will get Doc1, Doc2 and Doc3, and if I select Doc1, it will show up in the grid. Now it should not be available as a result in the autocomplete since it no longer matches the initial condition.

If I search “Doc” again, I will get the same result. Doc1 is still there, but if I search “Doc1”, since there was actually a read, it won’t be in the results, which is expected.

So, how can I force an actual read every time I do a search to prevent this situation?

 

Veselin Tsvetanov
Telerik team
 answered on 23 Oct 2017
5 answers
825 views
I have setup a grid to display a complex object like so:

public class A
{
    public DateTime Created { get; set; }
}

public class B
{
    public A Subobject { get; set; }
    public DateTime Created { get; set; }
}

When I pass a list of B objects, the Created fields for both A and B are set properly.  However, while the Kendo grid appears to handle B's Created property as a Date/Time, A's Created property appears to get converted to a string as it appears in the format "/Date(#############)/" when displayed in the grid.

This appears to cause A's Created field to be posted back as a Date/Time.Min value (01/01/0001) when the record is Updated, instead of the "real" value when it was received from the server during the Read operation.  This causes ModelState.IsValid to be false.

Is there any way to fix this?  I found a post related to this at http://www.kendoui.com/forums/ui/grid/date-column-type-doesn-t-work-when-data-source-is-a-datatable.aspx, but can't seem to find where to set a ModelFieldDescriptor in MVC.

EDIT:

Some additional information.  This only happens when the Delete AJAX method is called.  When the Edit AJAX method is called, the Subobject property of object B is null and ModelState.IsValid is true.
Stefan
Telerik team
 answered on 23 Oct 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?