Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.5K+ views

I am displaying a Time field with datatype DateTime. I am displaying only time part at UI by using Data Format String  "{0:hh:mm:ss tt}")

(eg. field value:02:00:00 AM).

I want to apply filter on this field but by default filter option provides DatePicker control to select date but I want only TimePicker control to be display in filter?

I don't want display DatePicker control because its not display in grid row.

Please let me know if there are any demo for this scenario.

Georgi
Telerik team
 answered on 28 Sep 2018
1 answer
160 views

As far as I know I have to reference JS-library 'kendo.culture.de-DE.min.js' and afterwards execute 'kendo.culture("de-DE")' to use culture specific formatting, even when using the MVC wrappers, right?

But do we actually have to use the Format() function for every field (numeric column in a grid) to show the correct number format? Why does it not apply the format automatically after already setting the kendo culture? Or do I have to tell kendo otherwise?

Veselin Tsvetanov
Telerik team
 answered on 27 Sep 2018
11 answers
3.3K+ views
I am using a treelist to display groups and items. On nodes that represent groups, I want to display the Add, Edit, and Delete buttons (which I have working now). On the nodes that are items I only want to show the Delete button. How do I conditionally hide the buttons for nodes that are items and not groups?
Stefan
Telerik team
 answered on 27 Sep 2018
1 answer
565 views

We would like to implement custom server side sort logic, while using the MVC wrappers with the Server() option in the DataSource. How can we achieve this?

Currently we're using the Ajax() option with Read(), and handling the DataSourceRequest, as a workaround.

Viktor Tachev
Telerik team
 answered on 27 Sep 2018
1 answer
160 views

When i have more than one dropdownlist on the page with ".Filter("contains")" but with unique names  (ie "Custodian_1", "Custodian_2",...) then when i click on one and make a selection and then click on another one and type "doe", then both dropdowns immediately reset to no selection made.  

 

@(Html.Kendo().DropDownListFor(m => m)
        .Name("Custodian")
        .DataTextField("Name")
        .DataValueField("LongId")
        .OptionLabel("Start typing to select user...")
        .Filter("contains")
        .HtmlAttributes(new { style = "width:100%;" })
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("UserSelector_Read", "Users");
            })
            .ServerFiltering(true);
        })
)

Neli
Telerik team
 answered on 26 Sep 2018
1 answer
591 views

Hi everyone,

I got an error in the updating process of the NuGet Package. I searched over the internet and it suggests me about the Package Manager Setting then update the package by selecting from the Package Source. I tried this process but that didn't work.

This is the error:

An error occurred while trying to restore packages: Unable to find version '2018.2.620' of package 'Telerik.UI.for.AspNet.Mvc5'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\:Package 'Telarik.UI.for.AspNet.Mvc5.2018.2.620' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NugetPackages\'.
https://api.nuget.org/v3/index.json: Package 'Telarik.UI.for.AspNet.Mvc52018.2.620' is not found on source 'https://api.nuget.org/v3/index.json'.
https://nuget.telerik.com/nuget: Failed to fetch results from V2 feed at 'https://nuget.telerik.com/nuget/Packages(Id='Telerik.UI.for.AspNetMvc5', Version=.2018.2.620') with following message : Response status code does not indicate success: 401 (Logon failed).

Veselin Tsvetanov
Telerik team
 answered on 26 Sep 2018
3 answers
150 views

I have a gantt on a page. The GanttTask object has Creator and Modifier on them and they need to be set on the client (so using javascript code).

I have attached to the save event like this

Html.Kendo().Gantt<ViewModel, DependencyViewModel>(),Name("gantt").Events(e => e.Add("onAdd").Save("onSave"))

and the javascript code

function onSave(e) {
  e.task.ModifiedBy = '@Html.Action("GetCurrentUser", "XXX")';
  e.task.ModifiedDate = new Date(Date.now());
}

When I change a task everything works as expected. However if I change a child task by changing the end date that affects also the parent I need to set the Modifier on that parent too.  

Is there an event called before updating the parents that I could use to set the Modifier ? How can I get the parents that are going to be updated in the onSave event?

Ivan Danchev
Telerik team
 answered on 25 Sep 2018
2 answers
620 views

We're attempting to do custom filtering on the server-side by passing additional data via the filters. However these custom filters do not correlate to any of the properties of the result set so we end up with an error:

Invalid property or field - 'GroupNameId' for type: InventorySearchResult

Unfortunately its not as simple as adding the GroupNameId to the result because GroupNameId is in a collection of Group Names, example:

MyEntity {
 Id = 1,
 Name = "name",
 GroupNames = <Collection of Group Names that I want to further filter against>
}

So what we do is query our data via IQueryable, extract the GroupNameGid filter from Request.Filters, then manually apply a filter for GroupNameGid to the expression, then we return the data via ToDataSourceResult(...). Unfortunately this results in the error mentioned above. I thought maybe I could remove the GroupNameGid filter from Request.Filters since I'm manually applying the filter and let ToDataSourceResult apply the rest of its magic. However this turned out to be rather complicated due to CompositeFilterDescriptor. So I'm curious to know if there is any way to easily remove a specific filter from request.Filters.

Thanks

Denny
Top achievements
Rank 1
 answered on 24 Sep 2018
4 answers
580 views

Hi 

I have problem binding DateTime field. I modified your example :https://demos.telerik.com/aspnet-mvc/spreadsheet/datasource

and added 

 [DataType(DataType.Date)]
        public DateTime TimeTest 
        {
            get;
            set;
        } = DateTime.Today;

to SpreadsheetProductViewModel.cs 

It displays the TimeTest field properly in excel sheet, but if I modify the date and submit the change, ModelState validation fails with following error:

The models contain invalid property values.The value 'Sat Jan 20 2018 00:09:00 GMT-0800 (Pacific Standard Time)' is not valid for TimeTest.

 

Please advice,

Thank you,

 

 

 

 

 

 

 

Joana
Telerik team
 answered on 24 Sep 2018
2 answers
629 views

I've got a grid set up as follows, where I'm trying to implement a basic multi-column search with an array of filters:

@(Html.Kendo().Grid<OpenPurchaseOrder>()
          .Name("grid")
          .DataSource(dataSource =>
            dataSource.Ajax()
              .Read(read => read.Action("OpenPurchaseOrders_Read", "GoodsIn"))
          )
    .ToolBar(toolbar =>
    {
      toolbar.Template(@<text>
                         <div class="toolbar">
 
                           <div class="row">
                             <div class="col-md-4">
                               <div class="input-group">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
                                 <input type="text" class="form-control" id='FieldFilter' placeholder="Search for...">
                                 <span class="input-group-btn">
                                   <button class="btn btn-default" type="button"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
                                 </span>
                               </div>
                             </div>
                           </div>
                         </div>
                        </text>);
    })
     
    .Pageable()
              .Filterable()
              .Sortable()
              .Navigatable()
              .Columns(columns =>
              {
                var colHeadingStyle = "white-space: normal; vertical-align: top;";
 
                columns.Bound(docType => docType.PurchaseId)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle });
                columns.Bound(docType => docType.ContactName)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle });
                columns.Bound(docType => docType.PoType)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle });
                columns.Bound(docType => docType.PoDate)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle }).Format("{0:dd MMM yyyy}");
          //columns.Command(commands =>
          //{
          //  commands.Select();
          //}).Title("").Width(180);
          columns.Bound(p => p.PurchaseId).ClientTemplate(
                  "<a class='btn  btn-default' href='" +
                  Url.Action("Create", "GoodsIn") +
                  "?PurchaseId=#= PurchaseId #'" +
                  ">Receive</a>"
                  ).Title("").Width(80).Filterable(false);
              }))

 

<script type="text/javascript">
  $(document).ready(function () {
    $("#FieldFilter").keyup(function () {
 
      var value = $("#FieldFilter").val();
      var grid = $("#grid").data("kendoGrid");
 
      if (value) {
        grid.dataSource.filter({
          logic: "or",
          filters: [
            {
              field: "PurchaseId",
              operator: "eq",
              value: value
            },
            {
              field: "ContactName",
              operator: "contains",
              value: value
            },
            //{
            //  field: "PoDate",
            //  operator: "equals",
            //  value: value
            //}
          ]
        });
      } else {
        grid.dataSource.filter({});
      }
    });
  }); 
</script>

 

And the data source is a list of these:

public class OpenPurchaseOrder
{
    [Display(Name = "Supplier")]
    public string ContactName { get; set; }
    [Display(Name = "PO No")]
    public int PurchaseId { get; set; }
    public int? DeliverTo { get; set; }
    [Display(Name = "PO Type")]
    public string PoType { get; set; }
    [Display(Name = "PO Date")]
    public DateTime? PoDate { get; set; }
}

 

That works fine if I comment out either the PurchaseId filter or the ContactName filter, but if I have them both I get System.FormatException: 'Input string was not in a correct format.' .  I'm guessing that's because one column contains a string field and the other contains an int field?  Is there any way to get round that?

I'm guessing that's because 

 

 

 

 

 

Tom
Top achievements
Rank 1
 answered on 22 Sep 2018
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?