Telerik Forums
UI for ASP.NET MVC Forum
2 answers
229 views

I have a scheduler code like below, but it is not working although it has rendered a drop-down list but no data inside. Any help?

<script id="popup_editor" type="text/x-kendo-template">
    <div class="k-edit-form-container">
        <div class="k-edit-label"><label for="Product">Product</label></div>
        <div id="example" class="k-edit-field" data-container-for="ProductID">
            <input data-role="dropdownlist" data-text-field="Name" data-value-field="Id" data-bind="source: arr" />
        </div>
    </div>
</script>

@(Html.Kendo().Scheduler<KendoUI.Northwind.Dashboard.Controllers.ScheduleTableViewModel>()
    .Name("scheduler")
    .Editable(editable => editable
        .EditRecurringMode(SchedulerEditRecurringMode.Dialog)
    .TemplateId("popup_editor")
    )
    .Selectable(false)
    .Views(views =>
    {
        views.DayView();
        views.WeekView();
        views.WorkWeekView(workWeekView => workWeekView.Selected(true));
        views.MonthView();
        views.AgendaView();
        views.TimelineView();
    })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.RecId);
            m.Field(f => f.Title).DefaultValue("No title");
            m.RecurrenceId(f => f.RecurrenceID);
        })
        .Read(read => read.Action("ScheduleTables_Read", "SchedulerMvc"))
        .Create(create => create.Action("ScheduleTables_Create", "SchedulerMvc"))
        .Update(update => update.Action("ScheduleTables_Update", "SchedulerMvc"))
        .Destroy(destroy => destroy.Action("ScheduleTables_Destroy", "SchedulerMvc"))
    )

<script>
    var arr = new kendo.data.ObservableArray([
    { Name: "John Doe", Id: 23 },
    { Name: "Jane Doe", Id: 34 }
    ]);

    var viewModel = kendo.observable({
        arr: arr //Temp solution, eventually will bind to a remote
    });

    kendo.bind($("#popup_editor"), viewModel);
</script>

Veselin Tsvetanov
Telerik team
 answered on 21 Nov 2017
1 answer
200 views

Hi, May I know how to add additional Textbox field either in or numeric? I able to add a  list using the Resource, but it seems unable to add a textbox.

Thank you.

Ivan Danchev
Telerik team
 answered on 20 Nov 2017
5 answers
307 views

HI

I known textbox could be placed in HeaderTemplate.

Single TextBox as filter row in each column header
https://www.telerik.com/forums/single-textbox-as-filter-row-in-each-column-header
example
http://dojo.telerik.com/UbeFu

But Navigatable() method causes textbox not focused automatically on click.

How can I solve this kind of problem.

*input/type=checkbox works well but input/type=text not works : 

  .HeaderTemplate("<input type='text' />");

*Telerik DevCraft R2 2017 SP1.

Best regards

Chris

 

 

 

Tsvetina
Telerik team
 answered on 17 Nov 2017
1 answer
453 views

Hello,

I wish to be able to turn off the browser auto complete on the filter options (search and entering values).

Normally I would just add the following to the input but that doesn't appear to be working. We are using the MVC wrappers.

.attr('autocomplete', 'off');

Thank you

Lucy

Georgi
Telerik team
 answered on 17 Nov 2017
4 answers
213 views

Is there a server binding hierarchy web forms example floating around out there?

I see example projects: server-hierarchy and server-binding but am having trouble understanding how to use it in a web forms based MVC project.

 

In the view for server-binding example:

@model IEnumerable<KendoGridServerBinding.Models.Product>
 
@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view

 

and in the view for server-hierarchy example project:

@(Html.Kendo().Grid((IEnumerable<KendoGridServerHierarchy.Models.Category>)ViewBag.Categories)

 

Can someone explain the difference for referencing the controller server data in the two example projects?

Viktor Tachev
Telerik team
 answered on 17 Nov 2017
2 answers
160 views

Hi,

I have implemented a popup window that display a text and I need to close the popup if the user clicks outside of the window. Searching in telerik forums I have found that there is way to do this using the method $telerik.isMouseOverElementEx. But this method is available only for Telerik ASP.NET Ajax.

Is there an equivalent for this method in the product Telerik ASP.NET MVC?

Dan
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 17 Nov 2017
3 answers
1.8K+ views

Hi,

I'm trying to format the filter control for an integer column to not use decimals, separators or spinners. I'm using Kendo.Mvc version 2017.1.118.545.

Using the answer from another question I've tried the following approach:

c.Bound(m => m.Id)
  .Title("ID")
  .Filterable(ftb => ftb
    .Cell(cell => cell
      .Operator("eq")
      .ShowOperators(false)
    ).UI("integerFilter"));

 

function integerFilter(el) {
  el.kendoNumericTextBox({
    spinners: false,
    format: "#",
    decimals: 0
  });
}

 

However as per attached screenshot, this doesn't work.

Please advise how to achieve this behaviour as according to the API guide (and other questions), this is correct.

 

Thanks,

Chris

Preslav
Telerik team
 answered on 17 Nov 2017
2 answers
320 views

HI,

submenu's aren't working like I expect them to work.

In my menu the submenu below personal (line 20) & account (line 104) works like I would like it to work.

The menu's below hr-test (line 72) and hr (line 92) are strange and aren't showing all items

See also the attachment of hr-test. only 2 out of the 5 real menu items are shown

I can't find the reason why I only get some submenu's.

Could somebody help?

001.@(Html.Kendo().Menu()
002.            .Name(componentName: "Menu")
003.            .Animation(enable: true)
004.            .HtmlAttributes(new {@class = "m-k-menu-header"})
005.            .Items(items =>
006.            {
007.                items.Add()
008.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
009.                    .Text(value: "Portal")
010.                    .Action(actionName: "Index", controllerName: "Home")
011.                    .Items(innerChildren =>
012.                    {
013.                        innerChildren.Add()
014.                            .Text(value: "Improvementlist")
015.                            .Action(actionName: "index", controllerName: "improvement")
016.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
017.                    });
018.                items.Add()
019.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
020.                    .Text(value: "Personal").Action(actionName: "OverviewPresence", controllerName: "Presence")
021.                    .Items(innerChildren =>
022.                    {
023.                        innerChildren.Add()
024.                            .Text(value: "Manage presence")
025.                            .Action(actionName: "ManagePresence", controllerName: "Presence")
026.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
027.                        innerChildren.Add()
028.                            .Text(value: "Overview presence")
029.                            .Action(actionName: "OverviewPresence", controllerName: "Presence")
030.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
031.                        innerChildren.Add()
032.                            .Text(value: "Set week complete")
033.                            .Action(actionName: "Index", controllerName: "WeekComplete")
034.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
035.                    });
036.                items.Add()
037.                    .Text(value: "Plan")
038.                    .Action(actionName: "Index", controllerName: "Planned")
039.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
040.                items.Add()
041.                    .Text(value: "Write")
042.                    .Action(actionName: "Index", controllerName: "Written")
043.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
044.                items.Add()
045.                    .Text(value: "Client")
046.                    .Action(actionName: "Index", controllerName: "Client")
047.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
048.                items.Add()
049.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
050.                    .Text(value: "Project")
051.                    .Action(actionName: "NotFinished", controllerName: "Project")
052.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
053.                    .Items(innerChildren =>
054.                    {
055.                        innerChildren.Add()
056.                            .Text(value: "All Projects")
057.                            .Action(actionName: "Index", controllerName: "Project")
058.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
059.                        innerChildren.Add()
060.                            .Text(value: "All active Projects")
061.                            .Action(actionName: "NotFinished", controllerName: "Project")
062.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
063.                    });
064.                items.Add()
065.                    .Text(value: "Employee")
066.                    .Action(actionName: "Index", controllerName: "Employee")
067.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
068.                items.Add()
069.                    .Text(value: "PS")
070.                    .Action(actionName: "WrittenComplete", controllerName: "PS")
071.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
072.                items.Add()
073.                    .Text("HR")
074.                    .Items(children =>
075.                    {
076.                        children.Add().Text("Billability").Action("Billability", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
077.                        children.Add().Text("Jeans");
078.                        children.Add().Text("Compensation").Action("Compensation", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
079.                        children.Add().Text("Jeans");
080.                        children.Add().Text("Leave").Action("Leave", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
081.                        children.Add().Text("Jeans");
082.                        children.Add().Text("OverviewPresence").Action("OverviewPresence", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
083.                        children.Add().Text("Jeans");
084.                        children.Add().Text("YearTarget").Action("YearTarget", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
085.                        children.Add().Text("Jeans");
086.                        children.Add().Text("Knitwear");
087.                        children.Add().Text("Shirts");
088.                        children.Add().Text("Belts");
089.                        children.Add().Text("Socks");
090.                        children.Add().Text("Fan Zone");
091.                    });
092.                items.Add()
093.                    .Text(value: "HR")
094.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
095.                    .Items(innerChildren =>
096.                    {
097.                        innerChildren.Add().Text(value: "Billability").Action(actionName: "Billability", controllerName: "HR", routeValues: null).HtmlAttributes(new {@class = "m-k-menu-header"});
098.                        innerChildren.Add().Text(value: "Compensation").Action(actionName: "Compensation", controllerName: "HR", routeValues: null).HtmlAttributes(new { @class = "m-k-menu-header" });
099.                        innerChildren.Add().Text(value: "Leave").Action(actionName: "Leave", controllerName: "HR", routeValues: null).HtmlAttributes(new { @class = "m-k-menu-header" });
100.                        innerChildren.Add().Text(value: "OverviewPresence").Action(actionName: "OverviewPresence", controllerName: "HR", routeValues: null).HtmlAttributes(new { @class = "m-k-menu-header" });
101.                        innerChildren.Add().Text(value: "YearTarget").Action(actionName: "YearTarget", controllerName: "HR", routeValues: null).HtmlAttributes(new {@class = "m-k-menu-header"});
102.                    });
103. 
104.                items.Add()
105.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
106.                    .Text(value: "Account")
107.                    .Items(innerChildren =>
108.                    {
109.                        innerChildren.Add().Text(value: "Manage").Action(actionName: "Index", controllerName: "Manage", routeValues: null).HtmlAttributes(new {@class = "m-k-menu-header"});
110.                        innerChildren.Add().Text(value: "Log off").Url(value: "javascript:document.getElementById('logoutForm').submit()").HtmlAttributes(new {@class = "m-k-menu-header"});
111.                    });
112.            })
113.            )

 

 

Ivan Danchev
Telerik team
 answered on 17 Nov 2017
3 answers
965 views

Hi there, Im using MVC 5 and really battling to populate the model with what is currently in the listbox. I have done some research and can see recommendations to use Ajax but surely this should be a basic model binding?

I can pass the selected items correctly back to the controller via the event on add however Im still lost how I can assign this to the DeviceList object within the model. Am I being silly? Many thanks :)

See Model :

    public class DeviceGroupDetailModel
    {
        public int Id { get; set; }
        [Display(Name = "Name")]
        public string Name { get; set; }
        public string Company { get; set; }
        public List<DeviceModelList> DeviceList { get; set; }


        public DeviceGroupDetailModel()
        {
            DeviceList = new List<DeviceModelList>();
        }
    }

See Razor :

(In Create.cshtml)

@using (Html.BeginForm("Create", "DeviceGroups", new { area = "" }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>New group details</h5>
                    </div>
                    <div class="ibox-content">
                        @Html.Partial("_DeviceGroupDetail", Model)
                        @Html.Partial("_DeviceList", Model)
                        <div class="form-group">
                            <div class="col-sm-10">
                                <button class="btn btn-primary" type="submit">Create group</button>
                                &nbsp;|&nbsp;
                                @Html.ActionLink("Cancel", "Index", "DeviceGroups", new { area = "" }, null)
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript">
        var dataSource;
        $(document).ready(function () {
            dataSource = new kendo.data.DataSource({
                serverFiltering: false,
                transport: {
                    read: {
                        url: '@Url.Action("DeviceList_Read", "DeviceGroups")',
                    dataType: "json"
                }
            },
            requestStart: function () {
                kendo.ui.progress($("#alldevicesid"), true);
                kendo.ui.progress($("#selectedid"), true);
            },
            requestEnd: function () {
                kendo.ui.progress($("#alldevicesid"), false);
                kendo.ui.progress($("#selectedid"), false);
            },
            batch: false
        });

        dataSource.fetch(function () {
            var data = this.data();
            var alldevices = $("#alldevices").data("kendoListBox");
            var selected = $("#selected").data("kendoListBox");
            for (var i = 0; i < data.length; i++) {
                alldevices.add(data[i]);
                selected.add(data[i]);
            }
        });
    });

        function onSelectListBoxAdd (e) {
            //debugger
            $.ajax({
                type: "POST",
                url: "/DeviceGroups/SelectedDevices",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({ selectedItems: $('#selected').data('kendoListBox').dataItems() }),
                dataType: "json",
                success: function (result) {
                    alert("Successfully sent to server: " + result.map(function (x) {
                        return x.SerialNumber
                    }))
                }
            });
    }
    </script>
}

(In DeviceList partial view)

<div id="alldevicesid" class="col-sm-3">
                        <label for="alldevices" id="all">All Devices</label>
                        @(Html.Kendo().ListBox()
                            .Name("alldevices")
                            .Toolbar(toolbar =>
                            {
                                toolbar.Position(Kendo.Mvc.UI.Fluent.ListBoxToolbarPosition.Right);
                                toolbar.Tools(tools => tools
                                    .TransferTo()
                                    .TransferFrom()
                                    .TransferAllTo()
                                    .TransferAllFrom()
                                );
                            })
                            .DataValueField("DeviceId")
                            .DataTextField("SerialNumber")
                            .Draggable(true)
                            .DropSources("selected")
                            .ConnectWith("selected")
                            .BindTo(new List<DeviceModelList>())
                            .Selectable(ListBoxSelectable.Multiple)
                        )
                    </div>

                    <div id="selectedid" class="col-sm-3">
                        <label for="selected">Selected Devices</label>
                        @(Html.Kendo().ListBox()
                                .Name("selected")
                                .Draggable(true)
                                .DropSources("alldevices")
                                .DataValueField("DeviceId")
                                .DataTextField("SerialNumber")
                                .ConnectWith("alldevices")
                                .BindTo(new List<DeviceModelList>())
                                //.BindTo(Model.DeviceList)
                                .Selectable(ListBoxSelectable.Multiple)
                                .Events(events => events
                                .Add("onSelectListBoxAdd"))
                        )
                    </div>

 

In Controller:

        public ActionResult SelectedDevices(List<DeviceModelList> selectedItems)
        {
            return Json(selectedItems);
        }

        private IEnumerable<DeviceModelList> GetDeviceList()
        {
            List<Device> devices = Managers.DeviceManager.GetList(DevicePart.VCM001, PaginationOptions.NoPaging()).Take(10).ToList();
            return Mapper.Map<IEnumerable<DeviceModelList>>(devices);
        }

        public ActionResult Create()
        {
            return View(new DeviceGroupDetailModel());
        }

        [HttpPost]
        public async Task<ActionResult> Create(DeviceGroupDetailModel model)
        {

        }

David
Top achievements
Rank 1
 answered on 17 Nov 2017
9 answers
989 views
Hi,

I don't know how I can use linq query in bounding a grid column to display a value.

If I use this code

    @(Html.Kendo().Grid<MYMODEL>(Model)
    .Name("myObject")
    .Columns(columns =>
    {
        columns.Bound(ViewBag["myList"].Where(p => p.Value == "2").Text);

I have an error : "cannot  use lamba expression without casting before.

Any help will be very much appreciated

Stefan
Telerik team
 answered on 17 Nov 2017
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
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
DropDownButton
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
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?