Telerik Forums
UI for ASP.NET MVC Forum
1 answer
65 views

Hi guys

 

If I use

Html.Kendo().DatePickerFor(mdl => mdl.SomeDate).Events(c => c.Change(...))

 

I get a problem in Chrome 80, in that it appears blank (it does have a value in the HTML) until I choose another date from the dropdown (and then it shows)

 

If I use 

Html.Kendo().DatePicker().Name(...).Value(Model.SomeDate).HtmlAttributes(new { type = "text" }).Events(c => c.Change(...))

 

Then it looks OK but doesn't fire the events when changed with the keyboard/dropdown

 

Any pointers? (and alas I can't upgrade either; seems the stuff in nuget doesn't target 4.6.1, only 4.5.2 or core; using too recent a one (anything after v2016.2.607) installs practically all of .net core as dependency, and anything before it wont install because of missing dependencies or target framework issues

chairman-mawh
Top achievements
Rank 1
 answered on 11 Mar 2020
1 answer
224 views

I like how I can set the filterable options for the whole grid according to data type as below:

Html.Kendo().Grid<MyModel>()
.Filterable(filterable =>
    {
        filterable.Extra(false);
        filterable.Operators(o =>
        {
            o.ForString(str => str.Clear().Contains("Contains").IsEqualTo("Is equal to"));
            o.ForEnums(en => en.Clear().IsEqualTo("Is equal to"));
        });
    });

 

However, I would like to set Extra(false) for Strings and Enums, but set Extra(true) for Numbers and DateTimes. Is there a way to set the Extra() flag per data type at the grid level without having to set it for each column at the column level?

 

 

 

 

Georgi
Telerik team
 answered on 09 Mar 2020
2 answers
243 views

As we deal with internationalization of our application we are seeing odd behavior from the ComboBox in IE 11 when the Placeholder is in a language using Unicode characters.

For example, the placeholder text "Select Ingredient" in English translates to

Vælg ingrediens - Danish

Wählen Sie Ingredient - German

Seleccione Ingrediente - Spanish

Välj ingrediens - Swedish

In English and Spanish, the ComboBox loads correctly. However, in Danish, German, and Swedish the ComboBox loads into the page already open. The same thing happens if I try to convert those Unicode characters to HTML-encoded. Is there a workaround?

Chris
Top achievements
Rank 1
 answered on 09 Mar 2020
4 answers
278 views

Hallo,

I try the demo of Pie chart in my iphone, but it doesn't display correctly with the labels, some of the labels show only a small part, is it is a bugs or need some configuration in the code?, zie screenshot in attach.

Denitsa
Telerik team
 answered on 09 Mar 2020
2 answers
1.1K+ views
Hi,

I used Asynchronous Mode of the Upload component in my MVC project, how do I pass extra parameters along with [files] to server side method? My form have kendo dropdown list. I try to pass the selected value  to Save action in controller but failed to do so.  Could someone help?  Thanks.

Second parameter in below Save function should hold that value.


        public ActionResult Async_Save(IEnumerable<HttpPostedFileBase> files, string dropdownListValue)
        {
            // The Name of the Upload component is "files"
            if (files != null)
        …
        …
        }
Martin
Telerik team
 answered on 09 Mar 2020
2 answers
227 views

     I am using this:  

 

@(Html.Kendo().MultiViewCalendar().Name("calendar").Views(3).ShowViewHeader().Min(new DateTime(2020, 7, 1)).Max(new DateTime(2020, 9, 30)).Events(e => e.Change("change"))
            )

 

and I simply want to highlight/change background color of a few days in a list in my model.  Is there a simple way of doing that?

Nikolay
Telerik team
 answered on 09 Mar 2020
13 answers
1.3K+ views

Hi

I am using a grid with with a ForeignKey-column.
Grid is displaying data from a database table, column is a nullable foreign key to another database table.

The grid displays my data as expected, except the nullable foreign key column.
Column stays empty in view, but value can (and is) selected in edit mode.

Main table class is:
{ long Id, string Text, long? ForeignKeyId }

ForeignKey class is:
{ long Id, string Text }

Cannot change classes, cause they are created by EntityFramework from database.
If I do it anyway and make "long? ForeignKeyId" > "long ForeignKeyId", it will display values in grid, but cannot select null value then.

Can't find a data-option-label like in normal DropDownList as well.

So my question is, how to use a ForeignKey-Column in a grid with an intended possible null value?

Greets Robin

Angel Petrov
Telerik team
 answered on 06 Mar 2020
2 answers
699 views

Hi I have grid with inline editing when i want to click cell to update i can see my timepicker and i can select value but when i pass next cell value is disappearing and not select or changing anything
How can i solve it?

@( Html.Kendo().Grid<MockUpForeNet.Controllers.CardDetailController.Days>()
        .Name("timegrid")
         .DataSource(d => d.Ajax().Read("TimeGridBinding", "CardDetail", new { rule = rule }).Update("UpdateTime","CardDetail").Model(keys =>
    {
       keys.Id(k => k.DayId);
       keys.Field(c => c.DayName).Editable(false);
       keys.Field(c => c.DayId).Editable(false);
       keys.Field("TimeStart", typeof(string)).Editable(true);
       keys.Field("TimeEnd", typeof(string)).Editable(true);
    }).PageSize(7))
               .Columns(c =>
                {
                    c.Bound(p => p.DayId).Width(100).Title(" ").ClientTemplate("#= chk2(data) #").Sortable(false);
                    c.Bound(e => e.DayName).Width(200).Title("Day");
                    c.Bound(e => e.TimeStart).Width(200).Title("Start Time").EditorTemplateName("StartTimeEditor");
                    c.Bound(e => e.TimeEnd).Width(200).Title("End Time").EditorTemplateName("EndTimeEditor");
                })
               .ToolBar(commands =>
                {
                    commands.Save().SaveText(" ").CancelText(" ");
                })
       .Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
       .Sortable()
       .ColumnMenu()
    )     
Nikolay
Telerik team
 answered on 06 Mar 2020
1 answer
2.8K+ views

Hi,

I have two controls(datepicker and dropdown) outside of the Kendo Grid, I want to send the selected values of those two controls to the controller along with the Grid values on click of save changes of the Kendo Grid.

Could you please help me how to pass those values along with Create or Update Action of Kendo Grid, or If I can bind those values creating hidden columns in the grid, as these values would be required in all the rows while updating.

Below is my view : 

@{
    ViewBag.Title = Project.Web_v5.Framework.PageTitleHelper.GetPageTitle("PigPriceEdit", Request.Url.AbsolutePath);
    Layout = "~/Views/Shared/_Layout_v2.cshtml";
    var sess = new aplCustomerPortal.SessionManagement();
}
<style>

    #grid .k-grid-header, .k-grid-header .k-header {
        color: palevioletred;
        font-size: large;
    }

    #inputvaluesbox {
        height: 25px;
        width:70%;
        margin:0;
    }
    .k-edit-cell input {
        width: 100%;
    }
</style>
@section Scripts
{
    <script type="text/javascript">
        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);
            }
        }

        function showEdit(e) {
            e.preventDefault();
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
            window.location.href = '@Url.Action("PigPriceEdit", "MarketingPigPrice")' + '?pModelId=' + dataItem.id + '&pContactId=@ViewBag.ContactId';
        }

        $(function () {
            kendo.culture("en-AU");
        });

          $("#bEdit").click(function () {
                window.location.href = '@Url.Action("PigPriceEdit", "MarketingPigPrice")'  + '&pContactId=@ViewBag.ContactId';
            });

       
    </script>
}

<div class="col-md-12">
    <form>

        <div class="form-group col-md-12">
            <br />
            <h3 class="panel-title">
                Form Type : Buyer
            </h3>
        </div>
        <div class="col-md-12">
            <div>
                <table>
                    <tr>
                        <td>
                            <h3>
                                Week End Date&nbsp;
                                @(Html.Kendo().DatePicker().Name("datepicker").Format("dd/MM/yyyy").DisableDates(DayOfWeek.Sunday, DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Saturday).HtmlAttributes(new { required = "required", validationmessage = "Week End is required", style = "width:100%;", placeholder = "dd/MM/yyyy" })
                                <br />
                            </h3>
                        </td>
                        <td>
                            &nbsp;&nbsp;&nbsp;
                        </td>
                        <td>
                            <h3>
                                State
                                @Html.DropDownList("StateList", new SelectList(ViewBag.PigStateList, "Value", "Key"), "-- Select One --", new { @class = "form-control", required = "required", validationmessage = "State is required", placeholder = "State", tabindex = "3", @id = "state", style = "width:250%; height:35px;" })
                            </h3>
                            <p>


                            </p>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="text-right btn-toolbar">
            <button id="bLoadPrevious" class="btn btn-sm btn-default" type="button">Fill Last Week’s Figures</button>&nbsp; &nbsp;
            <button id="bClearData" class="btn btn-sm btn-default" type="button">Clear Data</button>&nbsp; &nbsp;
        </div>
        <br />
        <br />
        <div class="form-group col-md-12">
            <div style="width:100%;overflow:auto;">
                @(Html.Kendo().Grid<Project.Core.EF.weekly_pigprice_data>
    ()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.pig_type).Title("Pig Type");
        columns.Bound(p => p.pig_weight).Title("Pig Weight").Width(140);
        columns.Bound(p => p.price_type).Title("Price Type").Width(140);
        columns.Bound(p => p.price).Title("Price(cent/kg)").Width(50);
        columns.Bound(p => p.number_traded).Title("Numbers").Width(50);

    })
    .ToolBar(toolbar =>
    {
        toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .HtmlAttributes(new { style = "height:1250px;" })
    .DataSource(dataSource => dataSource
    .Ajax()
    .Batch(true)
    .Group(g => g.Add(p => p.pig_type))
    .PageSize(50)
    .ServerOperation(false)
    .Model(model =>
    {
        model.Id(p => p.id);
        model.Field(p => p.id).Editable(false);
        model.Field(p => p.week_end_date);
        model.Field(p => p.state);
        model.Field(p => p.pig_type).Editable(false);
        model.Field(p => p.pig_weight).Editable(false);
        model.Field(p => p.price_type).Editable(false);
        model.Field(p => p.price);
        model.Field(p => p.number_traded);

    })
    .Events(events => events.Error("error_handler"))
    .Create("Editing_Create", "MarketingPigPrice", new { id = ViewBag.ContactId })
    .Read(read => read.Action("PigPriceEdit_Read", "MarketingPigPrice", new { id = ViewBag.ContactId }))
    .Update("Editing_Update", "MarketingPigPrice")
    .Destroy("Editing_Destroy", "MarketingPigPrice")
    )
    )
    <br />
</div>
            <br />
        </div>

    </form>
</div>

Viktor Tachev
Telerik team
 answered on 05 Mar 2020
4 answers
101 views

Hello!
I have a problem with filters in my scheduler: as shown in your base example,

I use a first filter applied on a member field called LabelTypeID (the same as OnwerID in your example).

My Model has a second (int ?) member called LabelID
In some case I have to filter only the LabelID (to select a single label, associated to the Calendar Event)

So, in my template I added a second resource for the LabelID, where the binding returns all possible labels:

.Resources(resource =>
 
  {
 
      resource.Add(m => m.LabelTypeID)
 
      .DataTextField("Text")
 
      .DataValueField("Value")
 
      .DataColorField("Color")
 
      .BindTo((new ACSDoorSignage.BIZ.LabelTypeBiz()).GetAllLabelTypesAsRazorArray(false));
 
  
      resource.Add(m => m.LabelID)
 
      .DataTextField("Text")
 
      .DataValueField("Value")       
 
      .BindTo((new ACSDoorSignage.BIZ.LabelBiz()).GetLabelsAsRazorArray(false));
        
  })

This is the filter that I try to use, where labelValue is one of the value returned in the binding (eg 1)

if (labelValue != -1) {
 
          var filter = {
 
              logic: "or",
 
              filters: new Array()
 
          };
 
          filter.filters.push(
 
           {
              operator: "eq",
 
              field: "LabelID",
 
              value: labelValue
 
          });
      }
 
      var scheduler = $("#scheduler").data("kendoScheduler");
 
      scheduler.dataSource.filter(filter);

 

The filter Always fails and I see on the browser:

Uncaught TypeError: (d.LabelID || "").toLowerCase is not a function

Can you help me to unserstand what happened?

If I'd like to apply a filter, MUST I Always define a resource for that filter?

 

Martin
Telerik team
 answered on 05 Mar 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?