Telerik Forums
Kendo UI for jQuery Forum
2 answers
167 views
Having an issue using a function for the background color for a series marker with the latest Kendo release (2014.1.526).
If I revert to the 2013Q3, it works fine.

Working sample... 
http://jsbin.com/jotaj/3/edit

Non-working sample....
http://jsbin.com/jotaj/4/edit

Thanks.

Robin
Robin
Top achievements
Rank 1
 answered on 05 Jun 2014
1 answer
270 views
Hi,

I need a kendo scheduler in which in month view  month start with  15/01/ 2014 and end with 15/02/2014 (for example).
My question is : Is it possible by any how?

Can I extend month view by --  kendo.ui.monthView.extend({  })  dynamically?

(any idea?)

Plz help.
Vladimir Iliev
Telerik team
 answered on 05 Jun 2014
1 answer
297 views
Hi,
I have a grid with  'Grouping' enabled for the grid and footerTemplate, groupFooterTemplate and groupHeaderTemplate for the columns.
I need to show the grid grouped by an specified column but should be possible to drag new columns to the group area.

The problem is that when you drag a new column to the group area the grid columns are not re-spaced correctly,  the data rows align themselves to the left, meaning many items will now be under the wrong column header.

Without the "footerTemplate, groupFooterTemplate and groupHeaderTemplate" the spacing works as it should, but with the templates in the columns,  once you drag a new column to the group area, the grid fails and spacing fails.

Here's my code with and without template.

http://jsfiddle.net/Dyb9Y/57/
http://jsfiddle.net/Dyb9Y/58/

Thanks
Alexander Popov
Telerik team
 answered on 05 Jun 2014
1 answer
75 views
Hi,

I am using a Date Time column in kendo grid and it is properly working in Chrome because the service will accept only  GMT time stamp zone, but in IE the date time is parsing as EDT.

Please suggest me what need to be done
Alexander Popov
Telerik team
 answered on 05 Jun 2014
1 answer
456 views
Hi,

When using Snipping Tool (in Win-7 or Win-8) to do Screen Capture (use CTRL-C to copy it into clipboard) and use CTRL-V to paste it into the Editor, it perfectly pasted into Editor using IE-11.
However, when we use Chrome Browser then the above scenario is not working (we cannot paste the screen capture image into the Editor).

We have also tried using third party screen capture software, CTRL-V works perfectly to paste the image into the Editor in IE-11 but not in Chrome Browser.

Please help to investigate the root cause or the possible bug in the Editor object and advise what we should do to resolve this behavior of the Editor in Chrome browser.

Thank you.  
Alex Gyoshev
Telerik team
 answered on 05 Jun 2014
1 answer
524 views
Hello,

I have a form with a DatePicker. The Site is configured with german culture. If I set the format of the Datepicker to englisch format the submit event work as desired. But if I use the global format the form submit is blocked.

Page with Form:

@using NursingHomeStock.Resources
@model NursingHomeStock.Models.NursingHomeViewModel
 
@{
    ViewBag.Title = "Edit";
    Layout = "../Shared/_Layout.cshtml";
}
 
@using (Html.BeginForm("Edit", "NursingHome", FormMethod.Post, new { @class = "form-horizontal", @role = "form" }))
{
 
    @Html.AntiForgeryToken()
    <fieldset>
        <legend>Bearbeiten</legend>
        <div class="well">
            <div class="form-group">
                @Html.LabelFor(model => model.Name, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.Street, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.Street, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.PostalCode, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.PostalCode, new { @class = "form-control" })
                </div>
 
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.City, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.City, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.Description, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.Description, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.Phone, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.Phone, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.Fax, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.Fax, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.EMail, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.EMail, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.Website, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.Website, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.RTName, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.RTName, new { @class = "form-control" })
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.RTAddress, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @Html.TextBoxFor(model => model.RTAddress, new { @class = "form-control" })
                </div>
            </div>
        </div>
 
        <div class="well">
            <table class="table-condensed table-responsive">
                <thead>
                    <tr>
                        <th></th>
                        <th>@GlobalResources.Capacity</th>
                        <th>@GlobalResources.Approved</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>@GlobalResources.LongTimeCare</td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.CapacityLongTimeCare)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.ApprovedLongTimeCare)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.ShortTimeCare</td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.CapacityShortCare)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.ApprovedShortTimeCare)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.DailySupport</td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.CapacityDailyCare)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.ApprovedDailySupport)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.LongTimeSupport</td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.CapacityLongTimeSupport)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.ApprovedLongTimeSupport)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.AlternativeLivingEnvironmentLong</td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.CapacityAlternativeLivingEnvironment)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                        <td>
                            @(Html.Kendo().NumericTextBoxFor(model => model.ApprovedAlternativeLivingEnvironment)
                              .IncreaseButtonTitle(GlobalResources.Increase)
                              .DecreaseButtonTitle(GlobalResources.Decrease)
                              .Format("n0")
                              .Min(0)
                            )
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
 
        <div class="well">
            <table class="table-condensed table-responsive">
                <tbody>
                    <tr>
                        <td>@GlobalResources.LongTimeCare</td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-user"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.LongTimeCareI)
                                  .IncreaseButtonTitle(GlobalResources.Increase)
                                  .DecreaseButtonTitle(GlobalResources.Decrease)
                                  .Format("n0")
                                  .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-female"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.LongTimeCareII_f)
                                  .IncreaseButtonTitle(GlobalResources.Increase)
                                  .DecreaseButtonTitle(GlobalResources.Decrease)
                                  .Format("n0")
                                  .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-male"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.LongTimeCareII_m)
                                  .IncreaseButtonTitle(GlobalResources.Increase)
                                  .DecreaseButtonTitle(GlobalResources.Decrease)
                                  .Format("n0")
                                  .Min(0)
                                )
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.ShortTimeCare</td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-user"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.ShortTimeCare)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            @(Html.Kendo().DatePickerFor(model => model.ShortTimeCareForDate)
                                .Name("ShortTimeCareForDate")
                                //.Format("dd.MM.yyyy")
                                .Format("yyyy-MM-dd")
                            )
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.DailySupport</td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-user"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.DailySupport)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.LongTimeSupport</td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-user"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.LongTimeSupportI)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-female"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.LongTimeSupportII_f)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-male"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.LongTimeSupportII_m)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>@GlobalResources.AlternativeLivingEnvironmentLong</td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-user"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.AlternativeLivingEnvironmentI)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-female"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.AlternativeLivingEnvironmentII_f)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                        <td>
                            <div class="input-group">
                                <span class="input-group-addon"><span class="fa fa-male"></span></span>
                                @(Html.Kendo().NumericTextBoxFor(model => model.AlternativeLivingEnvironmentII_m)
                            .IncreaseButtonTitle(GlobalResources.Increase)
                            .DecreaseButtonTitle(GlobalResources.Decrease)
                            .Format("n0")
                            .Min(0)
                                )
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
 
 
        <div class="well">
            <div class="form-group">
                @Html.LabelFor(model => model.IsAlternative, new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    <div class="checkbox">
                        <label>
                            @Html.CheckBoxFor(model => model.IsAlternative)
                        </label>
                    </div>
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.CategoryItems, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
                    @(Html.Kendo().MultiSelectFor(model => model.SelectedCategoryItems)
                          .Name("SelectedCategoryItems")
                          .Placeholder(GlobalResources.AdditionalOffers)
                          .BindTo(Model.CategoryItems)
                    )
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.UserItems, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @(Html.Kendo().DropDownListFor(model => model.UserItems)
                          .Name("ApplicationUserId")
                          .DataTextField("Text")
                          .DataValueField("Value")
                          .BindTo(Model.UserItems)
                          .Value(Model.ApplicationUserId)
                    )
                </div>
            </div>
 
            <div class="form-group">
                @Html.LabelFor(model => model.RegionItems, new { @class = "col-xs-12 col-sm-12 col-md-3 col-lg-3 control-label" })
                <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                    @(Html.Kendo().DropDownListFor(model => model.RegionItems)
                          .Name("RegionId")
                          .DataTextField("Text")
                          .DataValueField("Value")
                          .BindTo(Model.RegionItems)
                          .Value(Model.RegionId.ToString())
                    )
                </div>
            </div>
        </div>
         
        <div class="well">
            <div class="form-group">
                <div class="col-md-offset-3 col-lg-offset-3 col-xs-12 col-sm-12 col-md-2 col-lg-2">
                    <button type="submit" class="btn btn-default">Save</button>
                </div>
            </div>
        </div>
 
    </fieldset>
}
 
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

_Layout Page:

@using System.Data.Entity.Core.Common.EntitySql
@using NursingHomeStock.Resources
@using NursingHomeStock.Utils
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/kendo/css")
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/kendo")
 
    @{
        string culture = System.Globalization.CultureInfo.CurrentCulture.ToString();
    }
 
    <script type="text/javascript">
    //set current to the "en-GB" culture script
    kendo.culture("@culture");
    $(document).ready(function() {
        App.ServerRootPath = '@HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority)@Url.Content("~/")';
    });
    </script>
    @Html.Stimulsoft().RenderMvcViewerScripts()
 
</head>
<body>
    <div class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <button type="button" class="navbar-toggle visible-xs pull-left" data-toggle="offcanvas">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                @*@Html.ActionLink(GlobalResources.NursingHomeStock, "Index", "NursingHome", null, new { @class = "navbar-brand" })*@
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    @Html.MenuLink(GlobalResources.Home, "Index", "NursingHome")
                    @Html.MenuLink(GlobalResources.About, "About", "Home")
 
                    @if (Request.IsAuthenticated && User.IsInRole("Admin"))
                    {
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">@GlobalResources.Administration <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                @Html.MenuLink(GlobalResources.Roles, "Index", "RolesAdmin")
                                @Html.MenuLink(GlobalResources.User, "Index", "UsersAdmin")
                                <li class="divider"></li>
                                @Html.MenuLink(GlobalResources.NewNursingHome, "Create", "NursingHome")
                                @*@Html.MenuLink(GlobalResources.Employees, "Index", "Employee")*@
                                @*@Html.MenuLink(GlobalResources.Residents, "Index", "Resident")*@
                            </ul>
                        </li>
                    }
                    @if (Request.IsAuthenticated && (User.IsInRole("Auditor") || User.IsInRole("Admin")))
                    {
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">@GlobalResources.Reports <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                @*<li class="dropdown-header">Demo</li>*@
                                @*@Html.MenuLink("Demo", "Demo", "Report")*@
                                @Html.MenuLink(GlobalResources.NursingHome, "Entire", "Report")
                            </ul>
                        </li>
                    }
                </ul>
                @Html.Partial("_LoginPartial")
            </div>
        </div>
    </div>
 
    <div class="container">
        @Html.Partial("_Branding")
    </div>
 
    <div class="container">
        <div class="row row-offcanvas row-offcanvas-left">
            <div class="col-sm-2 col-md-2 col-lg-2 sidebar sidebar-offcanvas" id="sidebar" role="navigation">
                @Html.Partial("_Sidebar")
            </div>
            <div class="col-sm-10 col-md-10 col-lg-10 main">
                @RenderBody()
            </div>
        </div>
    </div>
    @Html.Partial("_Footer")
 
 
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/angular")
    <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
    @Scripts.Render("~/bundles/google")
    @Scripts.Render("~/bundles/GoogleAnalytics")
    @Scripts.Render("~/bundles/nursinghomestock")
    @RenderSection("scripts", required: false)
</body>
</html>

Model Class:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using NursingHomeStock.Entities;
using NursingHomeStock.Resources;
 
namespace NursingHomeStock.Models
{
    public sealed class NursingHomeViewModel
    {
        public int Id { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Name")]
        public string Name { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Street")]
        public string Street { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "PostalCode")]
        public int PostalCode { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "City")]
        public string City { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ModifiedDate")]
        public DateTime ModifiedDate { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Phone")]
        public string Phone { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Fax")]
        public string Fax { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Email")]
        public string EMail { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Website")]
        public string Website { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "RTName")]
        public string RTName { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "RTAddress")]
        public string RTAddress { get; set; }
 
        public string ApplicationUserId { get; set; }
 
        public int RegionId { get; set; }
 
        public double? Latitude { get; set; }
 
        public double? Longitude { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Description")]
        public string Description { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "AlternativeLivingEnvironmentLong")]
        public bool IsAlternative { get; set; }
 
        public bool IsAvailable { get; set; }
 
        public int FreePlaces { get; set; }
 
        public ApplicationUser ApplicationUser { get; set; }
        public ICollection<AvailablePlaces> AvailablePlaces { get; set; }
        // public ICollection<EmployeeTransmission> EmployeeStatsTransmission { get; set; }
        // public ICollection<ResidentTransmission> ResidentStatsTransmission { get; set; }
        public ICollection<NursingHomeCapacity> NursingHomeCapacities { get; set; }
        public ICollection<CategorySet> CategorySet { get; set; }
 
        public string RawWebsite
        {
            get
            {
                if (string.IsNullOrEmpty(Website)) return string.Empty;
                return Website.StartsWith("http://") ? Website.Substring(7) : Website;
            }
        }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ApprovedShortTimeCare")]
        public int ApprovedShortTimeCare { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ApprovedDailySupport")]
        public int ApprovedDailySupport { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ApprovedLongTimeCare")]
        public int ApprovedLongTimeCare { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ApprovedAlternativeLivingEnvironment")]
        public int ApprovedAlternativeLivingEnvironment { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ApprovedLongTimeSupport")]
        public int ApprovedLongTimeSupport { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "CapacityShortCare")]
        public int CapacityShortCare { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "CapacityDailyCare")]
        public int CapacityDailyCare { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "CapacityCare")]
        public int CapacityLongTimeCare { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "CapacityAlternative")]
        public int CapacityAlternativeLivingEnvironment { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "CapacityAssistance")]
        public int CapacityLongTimeSupport { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "ShortTimeCare")]
        public int ShortTimeCare { get; set; }
 
        // [DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
        public DateTime ShortTimeCareForDate { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "DailySupport")]
        public int DailySupport { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "LongTimeCare")]
        public int LongTimeCareI { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "LongTimeCare")]
        public int LongTimeCareII_m { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "LongTimeCare")]
        public int LongTimeCareII_f { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "LongTimeSupport")]
        public int LongTimeSupportI { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "LongTimeSupport")]
        public int LongTimeSupportII_m { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "LongTimeSupport")]
        public int LongTimeSupportII_f { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "AlternativeLivingEnvironment")]
        public int AlternativeLivingEnvironmentI { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "AlternativeLivingEnvironment")]
        public int AlternativeLivingEnvironmentII_m { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "AlternativeLivingEnvironment")]
        public int AlternativeLivingEnvironmentII_f { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "User")]
        public SelectList UserItems { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "Region")]
        public SelectList RegionItems { get; set; }
 
        [Display(ResourceType = typeof(GlobalResources), Name = "AdditionalOffers")]
        public MultiSelectList CategoryItems { get; set; }
 
        public List<string> SelectedCategoryItems { get; set; }
    }
}

Controller:

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Web.Configuration;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using NursingHomeStock.Dto;
using NursingHomeStock.Entities;
using NursingHomeStock.Models;
using NursingHomeStock.Resources;
using NursingHomeStock.Utils;
using NursingHomeStock.Utils.Configuration;
using NursingHomeStock.Utils.Configuration.Notification;
using PagedList;
 
namespace NursingHomeStock.Controllers
{
    [Authorize]
    public class NursingHomeController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();
 
 
        #region Search
 
        [AllowAnonymous]
        public ViewResult Search()
        {
            ViewBag.Categories = new MultiSelectList(db.CategorySets.ToList(), "Id", "Name");
            ViewBag.Regions = new MultiSelectList(db.Regions.ToList(), "Id", "Name");
            return View();
        }
 
        [HttpPost]
        [AllowAnonymous]
        public ViewResult Search(NursingHomeSearchModel nursingHomeSearchModel)
        {
            ViewBag.Title = "Suchergebnisse";
            ViewBag.Type = "All";
            var relevantHomes = GetNursingHomes(nursingHomeSearchModel);
            return View("Index", relevantHomes);
        }
 
        private List<NursingHomeViewModel> GetNursingHomes(NursingHomeSearchModel nursingHomeSearchModel)
        {
            var nursingHomes = db.NursingHomes.ToList();
            var nursingHomeViewModels = new List<NursingHomeViewModel>();
 
            foreach (var nursingHome in nursingHomes)
            {
                var nursingHomeViewModel = new NursingHomeViewModel();
                NursingHomeDto nhDto = new NursingHomeDto(nursingHome, nursingHomeViewModel, db);
                nhDto.DbObject2ViewModel();
                nursingHomeViewModels.Add(nursingHomeViewModel);
            }
            return nursingHomeViewModels.Where(nh => NursingHomeFitsToFilter(nursingHomeSearchModel, nh)).ToList();
        }
 
        private bool NursingHomeFitsToFilter(NursingHomeSearchModel nursingHomeSearchModel, NursingHomeViewModel nh)
        {
            var retVal = NursingHomeFitsToParameter(nh, nursingHomeSearchModel.Sex, nursingHomeSearchModel.RoomCategory, nursingHomeSearchModel.CareType);
 
            if (nursingHomeSearchModel.RegionList != null && nursingHomeSearchModel.RegionList.Count > 0)
            {
                bool isInRegion = false;
                foreach (var reg in nursingHomeSearchModel.RegionList)
                {
                    if (isInRegion) continue;
                    isInRegion = nh.RegionId == int.Parse(reg);
                }
 
                retVal = retVal && isInRegion;
            }
 
            if (!string.IsNullOrEmpty(nursingHomeSearchModel.Name))
            {
                if (nursingHomeSearchModel.RoomCategory == null && nursingHomeSearchModel.RegionList == null && nursingHomeSearchModel.CareType == null) retVal = true;
                retVal = retVal && nh.Name.ToLower().Contains(nursingHomeSearchModel.Name.ToLower());
            }
 
            return retVal;
        }
 
        private bool NursingHomeFitsToParameter(NursingHomeViewModel nh, string sex, List<string> roomTypes, List<string> careTypes)
        {
            bool roomTypesFit = false;
            bool isMale = sex == "male";
            if (roomTypes != null && roomTypes.Count > 0)
            {
                foreach (var rt in roomTypes)
                {
                    if (roomTypesFit) break;
                    switch (rt)
                    {
                        case "OneBed":
                            if (careTypes != null && careTypes.Count > 0)
                            {
                                foreach (var ct in careTypes)
                                {
                                    switch (ct)
                                    {
                                        case "Ltc":
                                            roomTypesFit = nh.LongTimeCareI > 0;
                                            break;
                                        case "Stc":
                                            roomTypesFit = nh.ShortTimeCare > 0;
                                            break;
                                        case "Ds":
                                            roomTypesFit = nh.DailySupport > 0;
                                            break;
                                        case "Lts":
                                            roomTypesFit = nh.LongTimeSupportI > 0;
                                            break;
                                        case "Ale":
                                            roomTypesFit = nh.AlternativeLivingEnvironmentI > 0;
                                            break;
                                    }
                                }
                            }
                            //no care type chosen
                            else if (nh.LongTimeCareI + nh.AlternativeLivingEnvironmentI + nh.LongTimeSupportI > 0 + nh.DailySupport + nh.ShortTimeCare) roomTypesFit = true;
                            break;
                        case "TwoBed":
                            if (careTypes != null && careTypes.Count > 0)
                            {
                                foreach (var ct in careTypes)
                                {
                                    switch (ct)
                                    {
                                        case "Ltc":
                                            roomTypesFit = isMale ? nh.LongTimeCareII_m > 0 : nh.LongTimeCareII_f > 0;
                                            break;
                                        case "Stc":
                                            roomTypesFit = nh.ShortTimeCare > 0;
                                            break;
                                        case "Ds":
                                            roomTypesFit = nh.DailySupport > 0;
                                            break;
                                        case "Lts":
                                            roomTypesFit = isMale ? nh.LongTimeSupportII_m > 0 : nh.LongTimeSupportII_f > 0;
                                            break;
                                        case "Ale":
                                            roomTypesFit = isMale ? nh.AlternativeLivingEnvironmentII_m > 0 : nh.AlternativeLivingEnvironmentII_f > 0;
                                            break;
                                    }
                                }
                            }
                            else
                            {
                                //no care type chosen
                                roomTypesFit = isMale
                                                   ? nh.LongTimeCareII_m + nh.ShortTimeCare + nh.DailySupport + nh.LongTimeSupportII_m + nh.AlternativeLivingEnvironmentII_m > 0
                                                   : nh.LongTimeCareII_f + nh.ShortTimeCare + nh.DailySupport + nh.LongTimeSupportII_f + nh.AlternativeLivingEnvironmentII_f > 0;
                            }
 
                            break;
                    }
                }
            }
 
            return roomTypesFit;
        }
 
        #endregion Search
 
 
        // GET: /NursingHome/Details/5
        [AllowAnonymous]
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            NursingHome nursinghome = db.NursingHomes.Find(id);
            if (nursinghome == null)
            {
                return HttpNotFound();
            }
            NursingHomeViewModel nursingHomeViewModel = new NursingHomeViewModel();
            nursingHomeViewModel.CategoryItems = new MultiSelectList(db.CategorySets.ToList(), "Id", "Name", nursinghome.CategorySet.Select(x => x.Id));
            nursingHomeViewModel.UserItems = new SelectList(db.Users.ToList().OrderBy(u => u.UserName), "Id", "UserName", nursinghome.ApplicationUserId);
            nursingHomeViewModel.RegionItems = new SelectList(db.Regions.ToList().OrderBy(r => r.Name), "Id", "Name", nursinghome.Region);
            NursingHomeDto nhDto = new NursingHomeDto(nursinghome, nursingHomeViewModel, db);
            nhDto.DbObject2ViewModel();
            return View(nursingHomeViewModel);
        }
 
        // GET: /NursingHome/Create
        [Authorize(Roles = "Admin")]
        public ActionResult Create()
        {
            var nursingHome = new NursingHome {Name = "1 Name", RegionId = db.Regions.First().Id};
            db.NursingHomes.Add(nursingHome);
            db.SaveChanges();
            return RedirectToAction("Edit", new {nursingHome.Id});
        }
 
        // GET: /NursingHome/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            NursingHome nursinghome = db.NursingHomes.Find(id);
            if (nursinghome == null)
            {
                return HttpNotFound();
            }
            if ((User.IsInRole("Admin") || nursinghome.ApplicationUserId == User.Identity.GetUserId()))
            {
                NursingHomeViewModel nursingHomeViewModel = new NursingHomeViewModel
                {
                    UserItems = new SelectList(
                        db.Users.ToList().OrderBy(user => user.UserName)
                            .Select(user => new SelectListItem {Text = user.UserName, Value = user.Id.ToString()}), "Value", "Text"),
                    RegionItems = new SelectList(
                        db.Regions.ToList().OrderBy(region => region.Name)
                            .Select(region => new SelectListItem {Text = region.Name, Value = region.Id.ToString()}), "Value", "Text"),
                    CategoryItems =
                        new MultiSelectList(db.CategorySets.ToList(), "Id", "Name", nursinghome.CategorySet.Select(x => x.Id))
                };
                NursingHomeDto nhDto = new NursingHomeDto(nursinghome, nursingHomeViewModel, db);
                nhDto.DbObject2ViewModel();
                return View(nursingHomeViewModel);
            }
            return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
        }
 
        // POST: /NursingHome/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "Id,Name,Street,PostalCode,City,Phone,Fax,EMail,Website,RTName," +
                                                 "RTAddress,ApplicationUserId,RegionId,Description,IsAlternative," +
                                                 "SelectedCategoryItems,CapacityShortCare,CapacityDailyCare," +
                                                 "CapacityLongTimeCare,CapacityAlternativeLivingEnvironment," +
                                                 "CapacityLongTimeSupport,LongTimeCareI,LongTimeCareII_f,LongTimeCareII_m," +
                                                 "ShortTimeCare,DailySupport,LongTimeSupportI,LongTimeSupportII_f,LongTimeSupportII_m," +
                                                 "AlternativeLivingEnvironmentI,AlternativeLivingEnvironmentII_f,AlternativeLivingEnvironmentII_m," +
                                                 "ShortTimeCareForDate,ApprovedShortTimeCare,ApprovedDailySupport,ApprovedLongTimeCare," +
                                                 "ApprovedLongTimeSupport,ApprovedAlternativeLivingEnvironment")] NursingHomeViewModel nursingHomeViewModel)
        {
            var nursingHome = db.NursingHomes.Find(nursingHomeViewModel.Id);
            if ((User.IsInRole("Admin") || nursingHome.ApplicationUserId == User.Identity.GetUserId()))
            {
                if (ModelState.IsValid)
                {
                    var latLng = GoogleGeoCode.GeoCodeAddress(string.Format("{0} {1}, {2}", nursingHomeViewModel.PostalCode, nursingHomeViewModel.City, nursingHomeViewModel.Street));
                    nursingHomeViewModel.Latitude = latLng.Key;
                    nursingHomeViewModel.Longitude = latLng.Value;
                    nursingHomeViewModel.ModifiedDate = DateTime.Now;
 
                    NursingHomeDto nhDto = new NursingHomeDto(nursingHome, nursingHomeViewModel, db);
                    CheckAvailablePlaces(nhDto, nursingHome);
                    nhDto.ViewModel2DbObject();
                    db.Entry(nursingHome).State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
                return View(nursingHomeViewModel);
            }
            return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
        }
 
 
        /// <summary>
        /// Check Available Places and sends Email if the places has changed.
        /// </summary>
        /// <param name="nhDto"></param>
        /// <param name="nursingHome"></param>
        private void CheckAvailablePlaces(NursingHomeDto nhDto, NursingHome nursingHome)
        {
            var conf = (NotificationConfiguration)WebConfigurationManager.GetSection("notification");
            if (conf.Enabled)
            {
                StringBuilder body = new StringBuilder();
                if (nhDto.freePlacesHasChanged(body))
                {
                    SmtpClient sc = new SmtpClient(conf.Smtp.Name, conf.Smtp.Port);
                    MailMessage message = new MailMessage
                    {
                        Subject = "Änderung Anzahl freier Plätze, " + nursingHome.Name,
                        Body = "Die Anzahl der freien Plätze im Pflegeheim " + nursingHome.Name + " hat sich geändert!\n\n" + body,
                        From = new MailAddress(conf.From.Email),
                        IsBodyHtml = true
                    };
                    if (nursingHome.ApplicationUser != null)
                        message.To.Add(nursingHome.ApplicationUser.Email);
                    foreach (var recipient in conf.Recipients)
                    {
                        message.To.Add(((RecipientElement)recipient).Email);
                    }
                    sc.Send(message);
                }
            }
        }
 
        // GET: /NursingHome/Delete/5
        public ActionResult Delete(int? id)
        {
            NursingHome nursinghome = db.NursingHomes.Find(id);
            db.NursingHomes.Remove(nursinghome);
            db.SaveChanges();
            return RedirectToAction("Index");
        }
 
        private enum ViewType
        {
            Ltc, Stc, Ds, Lts, Ale, All
        }
 
        private const int TableElements = 15; // 20
 
        [AllowAnonymous]
        public ActionResult Index(string type, string page)
        {
            List<NursingHomeViewModel> filteredNursingHomes;
            if (User.Identity.IsAuthenticated && !User.IsInRole("Admin") && !User.IsInRole("Auditor"))
            {
                filteredNursingHomes = new List<NursingHomeViewModel>();
                string userId = User.Identity.GetUserId();
                var nursingHomes = db.NursingHomes.Where(m => m.ApplicationUserId == userId);
                foreach (var home in nursingHomes)
                {
                    var nursingHomeViewModel = new NursingHomeViewModel();
                    var nhDto = new NursingHomeDto(home, nursingHomeViewModel, db);
                    nhDto.DbObject2ViewModel();
                    filteredNursingHomes.Add(nursingHomeViewModel);
                }
            }
            else
            {
                switch (type)
                {
                    case "Ltc":
                        ViewBag.Title = GlobalResources.LongTimeCare;
                        filteredNursingHomes = GetNursingHomes(ViewType.Ltc, true);
                        break;
                    case "Stc":
                        ViewBag.Title = GlobalResources.ShortTimeCare;
                        filteredNursingHomes = GetNursingHomes(ViewType.Stc, true);
                        break;
                    case "Ds":
                        ViewBag.Title = GlobalResources.DailySupport;
                        filteredNursingHomes = GetNursingHomes(ViewType.Ds, true);
                        break;
                    case "Lts":
                        ViewBag.Title = GlobalResources.LongTimeSupport;
                        filteredNursingHomes = GetNursingHomes(ViewType.Lts, true);
                        break;
                    case "Ale":
                        ViewBag.Title = GlobalResources.AlternativeLivingEnvironment;
                        filteredNursingHomes = GetNursingHomes(ViewType.Ale, true);
                        break;
                    default:
                        ViewBag.Title = GlobalResources.AllNursingHomes;
                        filteredNursingHomes = GetNursingHomes(ViewType.All, false);
                        break;
                }
            }
            var onePageOfNursingHomes =
                filteredNursingHomes.ToPagedList(string.IsNullOrEmpty(page) ? 1 : int.Parse(page), TableElements);
            ViewBag.OnePageOfNursingHomes = onePageOfNursingHomes;
            ViewBag.Type = string.IsNullOrEmpty(type) ? "All" : type;
            return View(filteredNursingHomes);
        }
 
        [AllowAnonymous]
        public ActionResult Map(string type)
        {
            List<NursingHomeViewModel> filteredNursingHomes = null;
            switch (type)
            {
                case "Ltc":
                    ViewBag.Title = GlobalResources.LongTimeCare + " " + GlobalResources.Map;
                    filteredNursingHomes = GetNursingHomes(ViewType.Ltc, false);
                    break;
                case "Stc":
                    ViewBag.Title = GlobalResources.ShortTimeCare + " " + GlobalResources.Map;
                    filteredNursingHomes = GetNursingHomes(ViewType.Stc, false);
                    break;
                case "Ds":
                    ViewBag.Title = GlobalResources.DailySupport + " " + GlobalResources.Map;
                    filteredNursingHomes = GetNursingHomes(ViewType.Ds, false);
                    break;
                case "Lts":
                    ViewBag.Title = GlobalResources.LongTimeSupport + " " + GlobalResources.Map;
                    filteredNursingHomes = GetNursingHomes(ViewType.Lts, false);
                    break;
                case "Ale":
                    ViewBag.Title = GlobalResources.AlternativeLivingEnvironment + " " + GlobalResources.Map;
                    filteredNursingHomes = GetNursingHomes(ViewType.Ale, false);
                    break;
            }
            return View(filteredNursingHomes);
        }
 
        [AllowAnonymous]
        public ActionResult Region(string type)
        {
            List<NursingHomeViewModel> filteredNursingHomes = null;
            ViewBag.Regions = db.Regions.ToList();
            switch (type)
            {
                case "Ltc":
                    ViewBag.Title = GlobalResources.LongTimeCare + " " + GlobalResources.Region;
                    filteredNursingHomes = GetNursingHomes(ViewType.Ltc, false);
                    break;
                case "Stc":
                    ViewBag.Title = GlobalResources.ShortTimeCare + " " + GlobalResources.Region;
                    filteredNursingHomes = GetNursingHomes(ViewType.Stc, false);
                    break;
                case "Ds":
                    ViewBag.Title = GlobalResources.DailySupport + " " + GlobalResources.Region;
                    filteredNursingHomes = GetNursingHomes(ViewType.Ds, false);
                    break;
                case "Lts":
                    ViewBag.Title = GlobalResources.LongTimeSupport + " " + GlobalResources.Region;
                    filteredNursingHomes = GetNursingHomes(ViewType.Lts, false);
                    break;
                case "Ale":
                    ViewBag.Title = GlobalResources.AlternativeLivingEnvironment + " " + GlobalResources.Region;
                    filteredNursingHomes = GetNursingHomes(ViewType.Ale, false);
                    break;
            }
            return View(filteredNursingHomes);
        }
 
        private List<NursingHomeViewModel> GetNursingHomes(ViewType type, bool onlyAvailable)
        {
            var result = new List<NursingHomeViewModel>();
 
            foreach (var nursingHome in db.NursingHomes)
            {
                var nursingHomeViewmmodel = new NursingHomeViewModel();
                NursingHomeDto nhDto = new NursingHomeDto(nursingHome, nursingHomeViewmmodel, db);
                nhDto.DbObject2ViewModel();
                ProcessNursingHome(nursingHomeViewmmodel, type);
                if (type == ViewType.Ale)
                {
                    if (!nursingHomeViewmmodel.IsAlternative) continue;
                    result.Add(nursingHomeViewmmodel);
                }
                else if (onlyAvailable && !nursingHomeViewmmodel.IsAvailable) {}
                else result.Add(nursingHomeViewmmodel);
            }
 
            return result.OrderBy(x => x.Name).ToList();
        }
 
        private void ProcessNursingHome(NursingHomeViewModel nh, ViewType type)
        {
            switch (type)
            {
                case ViewType.Stc:
                    nh.IsAvailable = nh.ShortTimeCare > 0;
                    nh.FreePlaces = nh.ShortTimeCare;
                    break;
                case ViewType.Ltc:
                    nh.IsAvailable = (nh.LongTimeCareI + nh.LongTimeCareII_m + nh.LongTimeCareII_f) > 0;
                    nh.FreePlaces = (nh.LongTimeCareI + nh.LongTimeCareII_m + nh.LongTimeCareII_f);
                    break;
                case ViewType.Ds:
                    nh.IsAvailable = nh.DailySupport > 0;
                    nh.FreePlaces = nh.DailySupport;
                    break;
                case ViewType.Ale:
                    nh.IsAvailable = (nh.AlternativeLivingEnvironmentI + nh.AlternativeLivingEnvironmentII_m + nh.AlternativeLivingEnvironmentII_f) > 0;
                    nh.FreePlaces = (nh.AlternativeLivingEnvironmentI + nh.AlternativeLivingEnvironmentII_m + nh.AlternativeLivingEnvironmentII_f);
                    break;
                case ViewType.Lts:
                    nh.IsAvailable = (nh.LongTimeSupportI + nh.LongTimeSupportII_m + nh.LongTimeSupportII_f) > 0;
                    nh.FreePlaces = (nh.LongTimeSupportI + nh.LongTimeSupportII_m + nh.LongTimeSupportII_f);
                    break;
            }
        }
 
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
Daniel
Telerik team
 answered on 05 Jun 2014
1 answer
703 views
HI 

i am trying to learn Kendo UI controls and was following the Tutorial in http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/asp-net-mvc-4

when i run the project i get this error:

Unhandled exception at line 77, column 20 in http://localhost:50879/Default1/AddmotorPage

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'kendoDatePicker'


i even added <script src="/Scripts/jquery-1.10.2.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.1.528/js/kendo.all.min.js"></script>

on the view itself but am still getting this error, can any body suggest any solution.

Thanks in advance.
Sebastian
Telerik team
 answered on 05 Jun 2014
1 answer
1.0K+ views
Hi,

I have a kendo grid in and aspx page that gets data from database. This data is pretty huge and will get bigger. Hence it is taking time. So I want to implement serverpaging and filtering logic here. Here is my code:

// aspx page code
 
var new_url = "/getdata.aspx?dt="+ date_passed
var data_source1 = new kendo.data.DataSource({
 
                    transport: {
                        read: {
                            url: new_url,
                            dataType: "json"
                        },
                        cache: true
                    },                  
                    pageSize: 100,
                    page: 1
                });
 
                var grid_updated = $("#gridAllRuns").kendoGrid({
                    dataSource: data_source1,
                    dataBound: onDataBound,
                    height: $(document).height() - 250,
                    groupable: true,
                    sortable: true,
                    columnMenu: true,
                    reorderable: true,
                    resizable: true,
                    pageable: {
                        refresh: true,
                        pageSizes: [100, 500, 1000],
                        pageSize: 100,
                        buttonCount: 10
                    },
                   filterable: {
                        extra: false,
 
                        operators: {
                            string: {
                                eq: "equal to",
                                startswith: "starts with",
                                neq: "not equal to"
                            }
                        }
                    },
                    toolbar: kendo.template($("#template").html()),
                    columns: [{ title: "Firstname", field: "fname"}, { title: "Lastname", field: "lname"}]
});
// getdata.aspx.vb code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 Dim for_date As String = Request.QueryString("dt")
Dim get_data As String = "select fname, lname where dt_passed ='" & for_date & "' order by fname"
        Dim url As String = HttpContext.Current.Request.Url.AbsoluteUri
        Dim data As String = ""
        Dim constr As String = constr
        Dim connection As New MySqlConnection(constr)
        connection.Open()
        Dim command As New MySqlCommand(get_data, connection)
        command.CommandType = System.Data.CommandType.Text
        Dim da As New MySqlDataAdapter()
        da.SelectCommand = command
 
        Dim dt As New DataTable()
        da.Fill(dt)
        'Console.Write(GetJson(dt))
 
        Response.Clear()
        Response.ContentType = "application/json; charset=utf-8"
        Response.Write(GetJson(dt))
        Response.End()
end sub
Public Function GetJson(ByVal dt As DataTable) As String
      Dim serializer As New System.Web.Script.Serialization.JavaScriptSerializer()
        serializer.MaxJsonLength = 107869240
        Dim rows As New List(Of Dictionary(Of String, Object))()
        Dim row As Dictionary(Of String, Object) = Nothing
 
        For Each dr As DataRow In dt.Rows
            row = New Dictionary(Of String, Object)()
            For Each col As DataColumn In dt.Columns
                row.Add(col.ColumnName.Trim(), dr(col))
            Next
            rows.Add(row)
        Next
        Return serializer.Serialize(rows)
    End Function

I am returning everything at once. Is there any logic that I can perform serverpaging and serverfiltering while getting the data from database? Please help!!!
Alexander Valchev
Telerik team
 answered on 05 Jun 2014
1 answer
156 views
Hello,

I have a problem in my grid widget. In fact, I would like to know how change in a grid the default form which run with edit button (generated by the edit command), to a custom form.

I have tried to customize this by editable field with the template function, but where the template is store in an external file. Is it possible to addres this file in the template function ?

example : editable: {
mode: "popup",
template: kendo.template($("../../Views/Materiel/#popup-editor").html())
}


Best regards,

Kevin Quinton
Alexander Valchev
Telerik team
 answered on 05 Jun 2014
8 answers
1.5K+ views
Is there any way to reset the upload form without the control firing the remove event on previously uploaded files?
Dimiter Madjarov
Telerik team
 answered on 05 Jun 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Drag and Drop
Application
Map
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
DropDownTree
ListBox
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
Licensing
PivotGridV2
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?