Telerik Forums
UI for ASP.NET MVC Forum
5 answers
101 views

Hi Guys,

In my application I have a grid within a grid using ClientDetailTemplateId

in my subgrid I want to have 5 tabs, but in one specific instance I would like to have 6.
I created a script to remove the 6th tab with JavaScript, but this doesn't work in IE. and also it's not nice.

 

What I actually want is something like this.

if (#=MyId# == "9212")
                     {
                                 items.Add().Text("Title").Content(

where only if MyId = 9212 the item should be added,

but whatever I try I can't get it to work.

is there someone who can help me?

Thank you in advance.


Stefan
Telerik team
 answered on 11 Apr 2018
2 answers
419 views

I am really fresh to kendo and MVC.

This is my Index.cshtml file. I am trying to send new startDate and endDate to my controller . but looks like I am doing something wrong. 

I am trying to figure out how to post the change from datetimepicker towards my controller. 

 

@using Kendo.Mvc.UI
@{
    ViewBag.Title = "New Measurement Period";
}


<h1> New Measurement Period</h1>
<div>
    <label for="start">Start Date:</label>
    @(Html.Kendo().DateTimePicker()
                             .Name("startDate")
                             .Value(DateTime.Now)
                             .HtmlAttributes(new { style = "width: 100%", title = "datetimepicker" })
                             .DateInput()
    )
    <label for="end">End Date:</label>
    @(Html.Kendo().DateTimePicker()
                                .Name("endDate")
                                .Value(DateTime.Now)
                                .HtmlAttributes(new { style = "width: 100%", title = "datetimepicker" })
                                .DateInput()

    )
    @(Html.Kendo().Button()
                               .Name("primaryTextButton")
                               .HtmlAttributes(new { type = "button"})
                                                          .Content("Submit"))


   
     <script>
                $(document).ready(function () {
                    // create DateTimePicker from input HTML element
                    $("#datetimepicker").kendoDateTimePicker({
                        value: new Date(),
                        dateInput: true
                    });
                });

    </script>
</div>

 

Stefan
Telerik team
 answered on 11 Apr 2018
6 answers
173 views

Hi,

I have 8 (bootstrap) Tabs along with 8 PivotGrids (all with different names/ids, endpoints).

While some of them load correctly some, load the data, but then apply "display:none;" to the columns and rows (see attached).

I don't get any console errors, so not sure why this is happening, other than it doesn't like have 8 on one page?

I tried looking at the RequestEnd callback to maybe remove the "display:none;:" from the tables, but the data that's passed doesn't contain which PivotGrid it's for.

So i'm stuck any recommendations apart form "don't have 8 on one page :P"

Preslav
Telerik team
 answered on 10 Apr 2018
3 answers
480 views
Hi,I have a problem with data binding using a custom template for the editor for the Scheduler component.When double clicking an item in the scheduler my dialog is displayed, for for some reason, I am only able to databind against the properties of the ISchedulerEvent interface and not all the other properties of my ViewModel.ViewModel

Example:
public class MyViewModel : ISchedulerEvent
    {   
        buplic int MyId { get; set;}  
        public bool MyBool{ get; set;}
        public string MyString { get; set; }
        #region ISchedulerEvent
        public string Title { get; set; }
        public string Description { get; set; }
        public bool IsAllDay { get; set; }
        public DateTime Start {get;set;}
        public DateTime End { get; set; }
        public string StartTimezone { get; set; }
        public string EndTimezone { get; set; }
        public string RecurrenceRule { get; set; }
        public string RecurrenceException { get; set; }
        #endregion
}
-----------
View Example:
@(Html.Kendo().Scheduler<MyViewModel>()
      .Name("MyScheduler")
      .Date(DateTime.Today)
      .StartTime(DateTime.Today)
      .EndTime(DateTime.Today.AddYears(1))
      .Views(views =>
      {
          views.DayView();
          views.WeekView(weekView => weekView.Selected(true));
          views.MonthView();
      })
      .DataSource(d =>
      {
          d.Read(read => read.Url("/MyController/MyRead"));
          d.Update(update => update.Url("/MyController/MyUpdate"));
          d.Create(create => create.Url("/MyController/MyCreate"));
          d.Destroy(destroy => destroy.Url("/MyController/MyDelete"));
          d.Model(model =>
          {
              model.Id(f => f.MyId);
          });
      })
      .BindTo(new [] {
                    new ServiceWindowViewModel{
                        MyId = 1,
      MyBool = true,
      MyString = "Yay this is my string",
      
      Title = "title not used",
                        Description = "description not used",
                        End = DateTime.Now.AddHours(2),
                        EndTimezone = null,
                        IsAllDay = false,
                        RecurrenceException = null,
                        RecurrenceRule = null,
                        Start = DateTime.Now,
                        StartTimezone = null
                    }
                })     
      .Editable(editable => {
          editable.Confirmation(true);
          editable.Create(true);
          editable.Destroy(true);
          editable.Resize(true);
          editable.Update(true);
          editable.TemplateId("editor");
        })
    )<script id="editor" type="text/x-kendo-template">
<div class="k-edit-label"><label for="title">Title</label></div>
<div class="k-edit-field" data-container-for="title"><input type="text" class="k-input k-textbox" name="title" data-bind="value: title"></div>
<BR>   
<div class="k-edit-label"><label for="mystring">My String</label></div>
<div class="k-edit-field" data-container-for="mystring"><input type="text" class="k-input k-textbox" name="mystring" data-bind="value: mystring"></div>
</script>
-----------
Now My String editor box is displayed correctly... but the data is not displayed from the property of the view model... what am I doing wrong?Is there some other way to configure a custom edit popup for the Scheduler item? E.g. the editor for the grid seem to work better and is able to display all properties of my ViewModel correctly.Thanks,
Michael
Veselin Tsvetanov
Telerik team
 answered on 10 Apr 2018
1 answer
587 views

When I put a Combobox inside my upload template, it puts a script(Combobox script) within a script (template script).  The browser does not like this and stops rendering correctly.  How do I make this happen?

Thanks

Ivan Danchev
Telerik team
 answered on 09 Apr 2018
3 answers
824 views

I'm attempting to set the filter on some of my columns to Multi, just like the demo at https://demos.telerik.com/aspnet-mvc/grid/filter-multi-checkboxes shows.

I have tried it with and without an ItemTemplate, with and without Search, with and without a BindTo, and just about anything else I can think of.  The filter only ever shows a text box with the button opening a dropdown for equals/contains/starts with/etc, never the checkboxes expected. 

I'm using version 2017.3.1026.

Why does this not work like the demo?

@{Html.Kendo().Grid<PersonGridViewModel>()
    .Name("Grid2")
    .Columns(c =>
    {
        c.Bound(e => e.Race)     .Width(275).Filterable(f => f.Multi(true).Search(true));
        c.Bound(e => e.Ethnicity).Width(225).Filterable(f => f.Multi(true));
        // other columns
    }
    .Filterable(f => f.Mode(GridFilterMode.Row))
    .DataSource(d => d
        .Ajax()
        .ServerOperation(false)
        .Model(m => m.Id(r => r.ID))
        .Read(r => r.Action("action", "controller"))      // Actual names replaced with placeholder
    )
    .Render();
}
Stefan
Telerik team
 answered on 06 Apr 2018
1 answer
687 views

Hi

I see this code:

 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Kendo UI Snippet</title>

    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.223/styles/kendo.common.min.css"/>
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.223/styles/kendo.rtl.min.css"/>
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.223/styles/kendo.silver.min.css"/>
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.223/styles/kendo.mobile.all.min.css"/>

    <script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="http://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js"></script>
    <style>  
      .mySearchIconx {
        background-image: url("http://kendo.cdn.telerik.com/2017.1.223/styles/Bootstrap/sprite.png");
        background-position: -32px -240px;
      }
    </style>
</head>
<body>
  
<button id="button" type="button">Search</button>
<script>
$("#button").kendoButton({
    spriteCssClass: "mySearchIconx"
});
</script>
</body>
</html>

2 Questions

1) How does it know why to show the Search icon? Sprite.png contains a lot of icons? What to change if i want anither icon?

2) My project has a folder structure with "Content\Bootstrap\ in which folder the sprite.png is, i don't want to use

     background-image: url("http://kendo.cdn.telerik.com/2017.1.223/styles/Bootstrap/sprite.png");

but use my own file on disk. I tried a lot of combinations like:

     background-image: url("~\Content\Kendo\Bootstrap\sprite.png");

But i don't get it working

Any help is  appreciated

 

Eric

 

 

 

 

 

Ivan Danchev
Telerik team
 answered on 06 Apr 2018
2 answers
561 views

Hi,

I am having an issue trying to update the parent in a hierarchical grid after making changes in the child.
I am remembering which detail rows have been opened at the time they are opened using the DetailExpand event
I can get the data-uid's of all parent rows without issue.

So then when I update a child I need to refresh the child and also refresh the parent so that some counts are updated.
After the child is updated I call Read on the parent

$('#grid').data().kendoGrid.dataSource.read()


This also works as expected and the parent grid reloads its data with the new counts.
However I then want to re-open detail grids that were open before read was called so the user is back where they were, not be in the default situation that all rows are collapsed again.

I thought I could just call expandRow on the grid for the id(s) that I collected earlier

dataGrid.expandRow(dataGrid.tbody.find("tr[data-uid='" + id + "']"))

 

However the data-uid's for all of the parent rows have now changed making my collection useless.
I thought a slightly more noddy way to do it would be to remember the indexes of the rows that were open but this is no good as the rows can change order upon the data re-loading, those counts that are being updated are used in sorting, so that is no good.

Is there something I can do to keep the data-uid's consistent across calls or some other way of remembering which ones are expanded?

By the way I also tried:

$('#grid').data().kendoGrid.refresh()

 

This allows me to open up the rows that were expanded but it doesn't actually reload the data so the parent counts are not updated...

 

Brian
Top achievements
Rank 1
 answered on 05 Apr 2018
9 answers
766 views

Is there a way to make the value from an autocomplete column not go blank by default when you click the "Edit Button"?

The grid is correctly loading, but when I hit "Edit" instead of defaulting to the value that is loaded for my autocomplete column in "View" mode I get a blank value.

 

    @(Html.Kendo().Grid<CostCenterModel>()
        .Name("settinggrid")
        .AutoBind(true)
        .Editable(editable => editable.Mode(GridEditMode.InLine).DisplayDeleteConfirmation(false))
        .Columns(columns =>
        {
            columns.Bound(c => c.CompositeId).Hidden();
            columns.Bound(c => c.CostCenterOwner.NameAndId).EditorTemplateName("_ucUsersAutocomplete");
            columns.Bound(c => c.CostCenter);
            columns.Bound(c => c.Setting);
            columns.Bound(c => c.SendEmailsFlag).ClientTemplate("<input type='checkbox' # if (SendEmailsFlag) { #" +
                                                                    " checked='checked' " + "# } # onclick='return false' /> ").Title("Send Emails");

            columns.Command(commands =>

            { commands.Edit(); commands.Custom("Delete").HtmlAttributes(new { @class = "k-delete" }).Click("deleteRow"); }
            ).Title("Action").Width("100");

        })

        .ToolBar(toolbar => toolbar.Create().Text("Add New Cost Center Owner"))
        .Scrollable()
        .Sortable()
        .Filterable()
        .ColumnMenu()
        .Resizable(rsb => rsb.Columns(true))
        .Reorderable(r => r.Columns(true))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(model =>
            {
                model.Id(c => c.CompositeId); // Specify the property which is the unique identifier of the model.
                model.Field(c => c.CostCenterOwner).DefaultValue(new UserModel());

            })
            .Read(read => read.Action("Settings_ReadCostCenter", "Admin"))
            .Update(update => update.Action("Settings_UpdateCostCenter", "Admin"))
            .Create(create => create.Action("Settings_CreateCostCenter", "Admin"))
            )




    )

Supriya
Top achievements
Rank 1
 answered on 05 Apr 2018
3 answers
246 views

Hello,

We wish to be able to select/deselect the checkbox in the Checkbox selection column on click of the row as well as clicking the checkbox directly.

I can't seem to see any examples of this in your demos.

Thank you

Lucy

Konstantin Dikov
Telerik team
 answered on 04 Apr 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?