Telerik Forums
UI for ASP.NET MVC Forum
3 answers
151 views
Hi,

I would like to show a different template for the day and the week view of my scheduler. This works correctly when setting the 'AddDayEventTemplate' on the view. However when I change this to use 'AddDayEventTemplateId' (and reference the appropriate script tag) it doesn't show the template and just shows the default event template.

My code is:

<script id="day" type="text/x-kendo-template">
    <p>Day event #=title#</p>
</script>
 
 
<script id="week" type="text/x-kendo-template">
   <p>Week event #=title#</p>
</script>
 
 
@(Html.Kendo().Scheduler<SurveyPortal.Web.ViewModels.ScheduleViewModel>()
    .Name("adminScheduler")
    .Editable(e=>e.Destroy(false).Resize(false))
    .Views(v=>{
        v.DayView(m => m.ShowWorkHours(true).AllDayEventTemplateId("day"));
        v.WeekView(m => m.ShowWorkHours(true).AllDayEventTemplateId("week"));
        v.MonthView(m => m.Selected(true));
    })
    .Resources(r=>{
        r.Add(m => m.ItemType)
            .Title("ItemType")
            .DataValueField("ItemType")
            .DataTextField("Text")
            .ValuePrimitive(false)
            .BindTo(new[] {
                new {Text = "Survey", Value = Model.ScheduleItems},
                new {Text = "Request", Value = Model.ScheduleItems }
            });
    })
    .WorkDayStart(9, 0, 0)
    .WorkDayEnd(18, 0, 0)
    .DateHeaderTemplate("#=kendo.toString(date,'ddd dd/MM')#")
    .MajorTimeHeaderTemplate("#=kendo.toString(date, 'H:mm' )#")
    .BindTo(Model.ScheduleItems)
    .HtmlAttributes(new { @class = "crm_scheduler" })
)

If someone could let me know how to resolve that, it would be much appreciated.

Becky
Alexander Popov
Telerik team
 answered on 26 Nov 2014
3 answers
885 views
Hi Team,

       I have Two Issues..
      1 )     How to Reload whole Gantt  After Insert and Update .. By default it  refresh only inserted  and updated row . I need to update All the rows for some) condition and refresh the gantt after insert and upload.. 
          
      2)    Move,MoveStart, MoveEnd Events are not Triggered while dragging the row..

Thank You ..
Kiril Nikolov
Telerik team
 answered on 26 Nov 2014
5 answers
76 views
I just upgraded from Q2 to Q3 and our grids are all now showing an extra row in the header. Is this a styling issue? I recall something in the change log about multi-row headers, but I didn't expect it would be on by default.

http://screencast.com/t/bpaJ2rJ6l
Dimiter Madjarov
Telerik team
 answered on 26 Nov 2014
2 answers
109 views
Latest build.


I noticed that some grids column resizing no longer works.  It took a while to figure out why some worked and some not.

It seems that if the grid has a .ClientDetailTemplateId() defined - the column resizing no longer works?

Rosen
Telerik team
 answered on 26 Nov 2014
4 answers
494 views

We have multiple Heirachical grids but are having issues when trying to construct routing data that contains Guids. The following Template works fine, the Controller receives the Guid Value (Query String Parameters "ruleId:22222222-2222-2222-2222-222222222222") .The content of the tab being a partial view containing a sub-grid:

<script id="RuleDetailTemplate" type="text/x-kendo-template">
    @(Html.Kendo().TabStrip()
        .Name("detailTabs_#=RuleId#")
        .Items(items =>
        {
            items.Add().Text(Resources.DetailsLabel)
                .Selected(true)
                .LoadContentFrom("RuleDetailsTab", "Administration",
                    new { ruleId = "#=RuleId#" });
...
        }).ToClientTemplate()
    )
</script>

However if we replace the TabStrip with a Splitter the controller receives (Query String Parameters "ruleId:#=RuleId#"):

<script id="RuleDetailTemplate" type="text/x-kendo-template">
        @(Html.Kendo().Splitter()
        .Name("detailsContainer_#=RuleId#")
        .Panes(panes =>
        {
            panes.Add()
               .LoadContentFrom("RuleDetailsTab", "Administration",
                    new { ruleId = "#=RuleId#" });

        }).ToClientTemplate()
    )
</script>

We do not specifically want to use a Splitter in this case as there is only one panel but can not embed the sub grid directly as it will also not allow us to build the Model properties for a create.


Kelly
Top achievements
Rank 1
 answered on 26 Nov 2014
1 answer
227 views
Hello,

Using the Fluent UI cshtml helpers, I am loading a Kendo UI window, using a template. 

The template contains a grid, for which I utilise aggregates; namely the Sum.

When the window is activated on my page, I receive a javascript error "sum is undefined".

Note: the window is loading a grid of child elements to a parent row of data on the main page's grid. (Hierarchy). 

In my investigations,
 - the template loads the grid correctly and functions perfectly if I do not have aggregates

Any ideas guys?

Thanks,
Brendan

---- TEMPLATE ----
** for brevity, I cut out the .Add(), .Destroy() datasource calls

<script id="MaterialTraceItemsAdvancedTemplate" type="text/kendo-tmpl">
    <div id="details-container">
        <h4>#= Description #</h4>


        @(Html.Kendo().Grid<TraceItem>().Name("grid_#=OID#").Columns(columns =>
          {
              columns.Bound(o => o.Cert).Width(70);
              columns.Bound(o => o.Trace).Width(110);
              columns.Bound(o => o.ExpectedQty).Width(110).ClientFooterTemplate("Sum: #=sum#"); 
              columns.Command(command =>
                  {
                      command.Destroy();
                      command.Edit();
                  }).Width(110);
          }).Editable(editable => editable.Mode(GridEditMode.InLine)).ToolBar(toolbar =>
              {
                  toolbar.Create();
              }).DataSource(dataSource => dataSource.Ajax()
                                              .Batch(true)
                                              .Model(model =>
                                                  {
                                                      model.Id(mt => mt.Id);
                                                  })
                                               .Aggregates(aggregates =>
                                                {
                                                    aggregates.Add(p => p.ExpectedQty).Sum();
                                                })
                                              .Read(read => read.Action("MrclItems_TraceItems", "Receiving", new { OID = "#=OID#" }))
                                              .Events(events => events.Error("error_handler"))).Sortable().Scrollable().ToClientTemplate()
        )
    </div>
</script>

------ WINDOW

@(Html.Kendo().Window().Name("MaterialTraceItemsAdvanced")
    .Title("Material Trace")
    .Visible(false)
    .Modal(true)
    .Draggable(true).Width(800))

------ PARENT Grid command snippet

....
columns.Command(command => command.Custom("TraceItems").Click("grid_ShowDetails")).Width(100);
....

------ PARENT Grid invocation javascript
   var materialTraceItemsAdvancedTemplate = kendo.template($("#MaterialTraceItemsAdvancedTemplate").html());
    var dataItem;

    function grid_ShowDetails(e, scope) {
        e.preventDefault();

        dataItem = scope.dataItem($(e.currentTarget).closest("tr"));
        var wnd = $("#MaterialTraceItemsAdvanced").data("kendoWindow");
        wnd.content(materialTraceItemsAdvancedTemplate(dataItem));
        wnd.bind("activate", window_activate);
        wnd.center().open();
    }


    function window_activate() {
        var gridName = "#grid_" + dataItem.OID;
        var grid = $(gridName).getKendoGrid();
         grid.bind("edit", function (e) {
            if (e.model.isNew() && !e.model.dirty) {
                e.container
                  .find("input[name=Cert]") 
                  .val(traceCertTemplate) //variable provided from _MrclItemsGridView
                  .change(); 
                e.container
                  .find("input[name=Trace]") 
                  .val(traceValueTemplate) //variable provided from _MrclItemsGridView
                  .change(); 
            }
         });


       
    }
Nikolay Rusev
Telerik team
 answered on 25 Nov 2014
5 answers
6.9K+ views
I have a grid that's I want to refresh, with the old telerik mvc controls we could use ajaxrequest, but that does not seem to work with kendo grid.
How do I refresh the grid without having to reload the page?

Thanks
Gabriel
Top achievements
Rank 1
 answered on 25 Nov 2014
2 answers
111 views
Hi, I am trying to implement a Mobile example using Kendo UI ASP.NET MVC using Visual Studio 2013 Express for Web. 
http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/mobilelistview/overview

I've done this:
- Reference to kendo dll: C:\MovilLab\Kendo2014.2.1008\Kendo.Mvc.dll  (v 2014.2.1008.340)
- Add in the web.config of the view in Namespace tag: <add namespace="Kendo.Mvc.UI" />

Index.chtml

@using MovilLab;
@using MovilLab.Controllers;

<!DOCTYPE html>
<html>
<head>
    <title></title>
    @Html.Partial("~/Views/Comunes/HeaderCssJs.cshtml")
</head>
<body>
    @(Html.Kendo().MobileView()
        .Name("grouped")
        .Title("ListView")
        .Content(obj =>
            Html.Kendo().MobileListView()
                .Name("grouped-listview")
                .TemplateId("template") //configure the item template
                .FixedHeaders(true)

                .DataSource(dataSource => dataSource
                            .Read(read => read.Action("Read", "Home"))
                            .Group(group => group.Add("Letter", typeof(string)))
               )
        )
    )

    @(Html.Kendo().MobileApplication()
    .ServerNavigation(true)
    )

</body>
</html>


HeaderCssJs.cshtml   (is a PartialView)

<link href="~/Content/kendo/2014.2.1008/kendo.common.min.css" rel="stylesheet" />
<link href="~/Content/kendo/2014.2.1008/kendo.default.min.css" rel="stylesheet" />
<link href="~/Content/kendo/2014.2.1008/kendo.dataviz.min.css" rel="stylesheet" />
<link href="~/Content/kendo/2014.2.1008/kendo.dataviz.default.min.css" rel="stylesheet" />
<link href="~/Content/kendo/2014.2.1008/kendo.mobile.all.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Scripts/kendo/2014.2.1008/angular.min.js"></script>
<script src="~/Scripts/kendo/2014.2.1008/kendo.all.min.js"></script>
<script src="~/Scripts/kendo/2014.2.1008/kendo.aspnetmvc.min.js"></script>


HomeController.cs  (I have 2 actions):

public ActionResult Index()
{
       return View();
}

[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {
            var products = new[] {
            new { Name = "Sashimi salad", Letter = "S" },
            new { Name = "Chirashi sushi", Letter = "C" },
            new { Name = "Seaweed salad", Letter = "S" },
            new { Name = "Edamame", Letter = "E" },
            new { Name = "Miso soup", Letter = "M" },
            new { Name = "Maguro", Letter = "M" },
            new { Name = "Shake", Letter = "S" },
            new { Name = "Shiromi", Letter = "S" },
            new { Name = "Tekka maki", Letter = "T" },
            new { Name = "Hosomaki Mix", Letter = "H" },
            new { Name = "California rolls", Letter = "C" },
            new { Name = "Seattle rolls", Letter = "S" },
            new { Name = "Spicy Tuna rolls", Letter = "S" },
            new { Name = "Ebi rolls", Letter = "E" },
            new { Name = "Chicken Teriyaki", Letter = "C" },
            new { Name = "Salmon Teriyaki", Letter = "S" },
            new { Name = "Gohan", Letter = "G" },
            new { Name = "Tori Katsu", Letter = "T" },
            new { Name = "Yaki Udon", Letter = "Y" }
            };

            //return the data as JSON
            return Json(products.ToDataSourceResult(request));
        }

I compile and run, but my problem is that the Browser appear in blank! And I put a BreakPoint in Read Action in HomeController and not enter there!
When I check using F12 in Chrome Response Tab appear an error in data-source attribute. Any help??:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link href="/Content/kendo/2014.2.1008/kendo.common.min.css" rel="stylesheet" />
<link href="/Content/kendo/2014.2.1008/kendo.default.min.css" rel="stylesheet" />
<link href="/Content/kendo/2014.2.1008/kendo.dataviz.min.css" rel="stylesheet" />
<link href="/Content/kendo/2014.2.1008/kendo.dataviz.default.min.css" rel="stylesheet" />
<link href="/Content/kendo/2014.2.1008/kendo.mobile.all.min.css" rel="stylesheet" />
<script src="/Scripts/jquery-1.8.2.min.js"></script>
<script src="/Scripts/kendo/2014.2.1008/angular.min.js"></script>
<script src="/Scripts/kendo/2014.2.1008/kendo.all.min.js"></script>
<script src="/Scripts/kendo/2014.2.1008/kendo.aspnetmvc.min.js"></script>

</head>
<body>
    <div data-reload="false" data-role="view" data-stretch="false" data-title="ListView" data-use-native-scrolling="false" data-zoom="false" id="grouped"><div data-role="content"><ul data-fixed-headers="true" data-role="listview" data-source="{&quot;type&quot;:(function(){if(kendo.data.transports[&#39;aspnetmvc-ajax&#39;]){return &#39;aspnetmvc-ajax&#39;;} else{throw new Error(&#39;The kendo.aspnetmvc.min.js script is not included.&#39;);}})(),&quot;transport&quot;:{&quot;read&quot;:{&quot;url&quot;:&quot;/Home/Read&quot;},&quot;prefix&quot;:&quot;&quot;},&quot;serverPaging&quot;:true,&quot;serverSorting&quot;:true,&quot;serverFiltering&quot;:true,&quot;serverGrouping&quot;:true,&quot;serverAggregates&quot;:true,&quot;group&quot;:[{&quot;field&quot;:&quot;Letter&quot;,&quot;dir&quot;:&quot;asc&quot;}],&quot;filter&quot;:[],&quot;schema&quot;:{&quot;data&quot;:&quot;Data&quot;,&quot;total&quot;:&quot;Total&quot;,&quot;errors&quot;:&quot;Errors&quot;,&quot;model&quot;:{}}}" data-template="template" id="grouped-listview"></ul></div></div>

    <script>
jQuery(function(){ new kendo.mobile.Application(jQuery(document.body), {"hideAddressBar":true,"updateDocumentTitle":true,"serverNavigation":true}); });
</script>

<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
    {"appName":"Chrome","requestId":"50645a161c474181843daf7db7ac40ef"}
</script>
<script type="text/javascript" src="http://localhost:49837/5a71b082460e41bebf77ca5ae81229a0/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
</html>







TISAL
Top achievements
Rank 1
 answered on 25 Nov 2014
1 answer
137 views
I am having an issue when working with DropDownList components. After binding the component if a vertical scrollball is needed (too many records at once), if you scroll down in attempt to select a value, the combo box get closed. At second attempt the combo works fine and you can scroll down with any problem. 
Our project is running with kendo.web.js version “v2013.2.918”, due to internal project policies we are not allow to change neither .js version nor kendo.mvc dll. 
Is there any workaround to this issue for this version?

<div class="controlBlock">            <label>*@Html.RawLocalized(WorkspaceMessageKeys.WorkspaceType).ToString()</label>
            @(Html.Kendo().DropDownListFor(m => m.WorkSpaceTypeId)
                    .Name("WorkSpaceTypeId")
                    .HtmlAttributes(new { @class = "check" })
                    .DataTextField("WorkSpaceTypeDesc")
                    .DataValueField("WorkSpaceTypeId")
                    .OptionLabel(Html.RawLocalized(WorkspaceMessageKeys.Select).ToString())
                    .DataSource(source =>
                    {
                        source.Read(read =>
                        {
                            read.Action("FindWorkSpaceTypes", "WorkSpace")
                                .Type(HttpVerbs.Post);
                        })
                        .ServerFiltering(true);
                    })
                )
            <div>
                @Html.ValidationMessageFor(m => m.WorkSpaceTypeId)
            </div>
</div>

Thanks in advance. 



Georgi Krustev
Telerik team
 answered on 25 Nov 2014
3 answers
509 views
The implementation of GridBuilder<T>.TableHtmlAttributes() suggests that you should be able to call it multiple times and have the results merged:

public GridBuilder<T> TableHtmlAttributes(IDictionary<string, object> attributes)
{
  this.Component.TableHtmlAttributes.Clear();
  Kendo.Mvc.Extensions.DictionaryExtensions.Merge(this.Component.TableHtmlAttributes, attributes);
  return this;
}

However, when I try to call TableHtmlAttributes more than once on the same grid, the attributes added by the first call are removed by the second, even though the names do not conflict:

.TableHtmlAttributes(new KeyValuePair<string, object>("k-grid-tab-new-row", null).ToDictionary())
.TableHtmlAttributes(new KeyValuePair<string, object>("class", "custom-table-hover table table-bordered no-footer k-grid-single-line ").ToDictionary())

How can I prevent this behavior? 

We have several attribute-based custom functions that we have built on top of Kendo grids, and I would like to create optional extension methods for the MVC builder to add these in the grid definition, like this:

public static GridBuilder<T> TabNewRow<T>(this GridBuilder<T> builder)where T : class
{
    return builder.TableHtmlAttributes(new KeyValuePair<string, object>("k-grid-tab-new-row", null).ToDictionary());
}

The above approach is not possible if each call overwrites the previous ones.
Dimo
Telerik team
 answered on 25 Nov 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?