Telerik Forums
UI for ASP.NET MVC Forum
5 answers
301 views
Hi,
is it possible to authenticate a kendo ui for asp.net mvc app? i mean the same way we use [Authorize] for plain asp.net mvc 4.

Thanks in advance and i look forward to your kind responses
Atanas Korchev
Telerik team
 answered on 14 Mar 2013
3 answers
507 views
Hi,
I am new to Kendo and started working with the trial version. I have a scenario where in a Grid User should have the ability to drag value from one cell in grid to another cell and also drag one cell value from one grid to another. I have tried searching but cudn't finad any such demo. I have used this demo http://jsfiddle.net/JBeQn/ 
I tried changing the source but it is not working. Currently when i drag and drop in the grid in demo value of two columns are dragged i just need that only one value , say only value of text column should be dragged. 
I surely think I can get lots of input on this here.
Thanks
Alexander Valchev
Telerik team
 answered on 13 Mar 2013
2 answers
483 views
hi, I'm working around KendoUI Wrappers for ASP.NET MVC 4 .

Now, I'm having some problems with my Cascading DropdownList when I reload Parent data.

for example:
1. I have a dropdown list like this: Level 1 > Level 2 (Level 2 cascades from Level 1).
If i reload data from Level 1.
=> Level 2 will reload data from server too.
but:  if (Level 2 Old Values == Level 2 New Values) => Level 2 doesn't reset to default value anymore.

2. The second issue that:  When i have a Dropdown List with more than 3 levels.
Ex : Level 1 > Level 2 > Level 3 > Level 4>Level n.

I reload data from Level 1 
=> It resets Level 2 , Level 3 to default Values .
=> but it can't reset Level 4 and level n...

So, how can i resolve these problems :-s ...
and This is my code:
<div class="table-row">
    <div class="table-col-left">
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level1")
            .OptionLabel("-- Chọn ÐVHC Cấp 1 --")
            .DataTextField("TenDonViHanhChinh")
            .DataValueField("IdDonViHanhChinh")
            .BindTo(ViewBag.DVHCLevel1)
            .Value(obj_DefaultData.IdDVHCLevel1)
        )
    </div><!--END div.table-col-left -->
    <div class="table-col-right">
        <script type="text/javascript">
             
            function RimsAddrLevel1Item() {
                return {
                    IdDVHC: $("#rims-addr-level1").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level1-item")
            .OptionLabel("Select ...")
            .DataTextField("TenTinhThanh1")
            .DataValueField("IdTinhThanh")
            .DataSource(source => {
            source.Read(read =>
            {
                read.Action("FindAllTinhThanhByIdDVHC", "Base").Data("RimsAddrLevel1Item").Type(HttpVerbs.Post);
            })
            .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level1")
            .Value(obj_DefaultData.IdL01TinhThanh)
        )
    </div><!--END div.table-col-right -->
</div>
<!--END div.table-row TinhThanh---------------------------------- -->
<div class="table-row">
    <div class="table-col-left">
        <script type="text/javascript">
            function RimsAddrLevel2() {
                return {
                    IdDVHC: $("#rims-addr-level1").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level2")
            .OptionLabel("-- Chọn ÐVHC Cấp 2 --")
            .DataTextField("TenDonViHanhChinh")
            .DataValueField("IdDonViHanhChinh")
            .DataSource(source => {
            source.Read(read =>
            {
                read.Action("FindAllChildDVHCByIdDvhc", "Base").Data("RimsAddrLevel2").Type(HttpVerbs.Post);
            })
            .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level1-item")
            .Value(obj_DefaultData.IdDVHCLevel2)
        )
    </div>
    <!--END div.table-col-left -->
    <div class="table-col-right">
        <script type="text/javascript">
            function RimsAddrLevel2Item() {
                return {
                    IdDVHC: $("#rims-addr-level2").val(),
                    IdTinhThanh: $("#rims-addr-level1-item").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level2-item")
            .OptionLabel("Select ...")
            .DataTextField("TenQuanHuyen1")
            .DataValueField("IdQuanHuyen")
            .DataSource(source => {
                source.Read(read =>
                {
                    read.Action("FindAllQuanByIDTinhThanh", "Base").Data("RimsAddrLevel2Item").Type(HttpVerbs.Post);
                })
            .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level2")
            .Value(obj_DefaultData.IdL02QuanHuyen)
        )
    </div>
    <!--END div.table-col-right -->
</div>
<!--END div.table-row QuanHuyen---------------------------------- -->
<div class="table-row">
    <div class="table-col-left">
        <script type="text/javascript">
            function RimsAddrLevel3() {
                return {
                    IdDVHC: $("#rims-addr-level2").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level3")
            .OptionLabel("-- Ch?n ÐVHC C?p 3 --")
            .DataTextField("TenDonViHanhChinh")
            .DataValueField("IdDonViHanhChinh")
            .DataSource(source => {
                source.Read(read =>
                {
                    read.Action("FindAllChildDVHCByIdDvhc", "Base").Data("RimsAddrLevel3").Type(HttpVerbs.Post);
                })
                .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level2-item")
            .Value(obj_DefaultData.IdDVHCLevel3)
        )
    </div>
    <!--END div.table-col-left -->
    <div class="table-col-right">
        <script type="text/javascript">
            function RimsAddrLevel3Item() {
                return {
                    IdDVHC: $("#rims-addr-level3").val(),
                    IdQuan: $("#rims-addr-level2-item").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level3-item")
            .OptionLabel("Select ...")
            .DataTextField("TenPhuongXa1")
            .DataValueField("IdPhuongXa")
            .DataSource(source => {
                source.Read(read =>
                {
                    read.Action("FindAllPhuongXaByIDQuan", "Base").Data("RimsAddrLevel3Item").Type(HttpVerbs.Post);
                })
            .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level3")
            .Value(obj_DefaultData.IdL03PhuongXa)
        )
    </div>
    <!--END div.table-col-right -->
</div>
<!--END div.table-row PhuongXa---------------------------------- -->
<div class="table-row">
    <div class="table-col-left">
        <script type="text/javascript">
            function RimsAddrLevel4() {
                return {
                    IdDVHC: $("#rims-addr-level3").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level4")
            .OptionLabel("-- Ch?n ÐVHC C?p 4 --")
            .DataTextField("TenDonViHanhChinh")
            .DataValueField("IdDonViHanhChinh")
            .DataSource(source => {
                source.Read(read =>
                {
                    read.Action("FindAllChildDVHCByIdDvhc", "Base").Data("RimsAddrLevel4").Type(HttpVerbs.Post);
                })
                .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level3-item")
            .Value(obj_DefaultData.IdDVHCLevel4)
        )
    </div>
    <!--END div.table-col-left -->
    <div class="table-col-right">
        <script type="text/javascript">
            function RimsAddrLevel4Item() {
                return {
                    IdDVHC: $("#rims-addr-level4").val(),
                    IdPhuongXa: $("#rims-addr-level3-item").val()
                };
            }
        </script>
        @(Html.Kendo().DropDownList()
            .Name("rims-addr-level4-item")
            .OptionLabel("Select ...")
            .DataTextField("TenDuongKhu1")
            .DataValueField("IdDuongKhu")
            .DataSource(source => {
                source.Read(read =>
                {
                    read.Action("FindAllDuongKhuByIdPhuongXa", "Base").Data("RimsAddrLevel4Item").Type(HttpVerbs.Post);
                })
            .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
            .CascadeFrom("rims-addr-level4")
            .Value(obj_DefaultData.IdL04DuongKhu)
        )
    </div>
    <!--END div.table-col-right -->
</div>
<!--END div.table-row DuongKhu---------------------------------- -->

Georgi Krustev
Telerik team
 answered on 13 Mar 2013
4 answers
298 views
The detail records that are found and returned by the function HierarchyBinding_RegulatoryReference are not being shown. I have verified that the StudyID is being correctly sent in and that the LINQ returns records but they are not shown. It shows that there are 0 detail records.

Here is the view:

    @(Html.Kendo().Grid<StudyViewModel>()
        .Name("StudyGrid")
        .Columns(columns =>
            {
                columns.Bound(item => item.StudyID);
                columns.Bound(item => item.StudyName);
                columns.Bound(item => item.StudyDirectorName);
                columns.ForeignKey(p => p.NatureOfStudy, (IEnumerable<LRRI.QAM.ViewModels.NatureOfStudyWithIDViewModel>)ViewData["NatureOfStudyList"], "NatureOfStudyID", "NatureOfStudy");
                columns.ForeignKey(p => p.Status, (IEnumerable<LRRI.QAM.ViewModels.StudyStatusWithIDViewModel>)ViewData["StudyStatusList"], "StudyStatusID", "StudyStatus");
                columns.ForeignKey(p => p.Active, (IEnumerable)ViewData["ActiveList"], "ActiveID", "Active"); 
            })
            .ClientDetailTemplateId("studyRegulatoryReferenceTemplate")
            .DataSource(ds => ds
                .Ajax()
                .Model(model =>
                {
                    model.Id(m => m.StudyID);
                })
                .Sort(sort =>
                {
                    // Sort by Name in descending order
                    sort.Add(m => m.StudyName).Ascending();
                })
                .Read(read => read.Action("StudyDataSource", "Study"))
            )
        .Pageable()
        .Sortable()
        .Filterable()
          )
    <script id="studyRegulatoryReferenceTemplate" type="text/kendo-tmpl">
        @(Html.Kendo().Grid<LRRI.QAM.Models.StudyRegulatoryReference>()
                .Name("RegRef_#=StudyID#")
                .Columns(columns =>
                {
                    columns.Bound(o => o.RegulatoryReferenceID);
                    columns.Bound(o => o.RegulatoryReference);
                })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Read(read => read.Action("HierarchyBinding_RegulatoryReference", "Study", new { studyID = "#=StudyID#" }))
                )
                .Sortable()
                .ToClientTemplate()
        )  
    </script>

Here is the controller:

        public ActionResult StudyDataSource([DataSourceRequest] DataSourceRequest request)
        {

            var listValues = (from l in _context.Studies
                              orderby l.StudyName
                              select new QAM.ViewModels.StudyViewModel()
                              {
                                  StudyID = l.StudyID,
                                  StudyName = l.StudyName,
                                  ProtocolNumber = l.Protocol.ProtocolNumber,
                                  StudyDirectorFirst = l.StudyDirectorFirst,
                                  StudyDirectorLast= l.StudyDirectorLast,
                                  StudyDirectorName = l.StudyDirectorFirst + " " + l.StudyDirectorLast,
                                  NatureOfStudy = l.NatureOfStudy,
                                  RouteOfAdmin = l.RouteOfAdmin,
                                  Status = l.Status,
                                  StudyType = l.StudyType,
                                  GLP = (((Boolean?)l.GLP ?? false) ? 1 : 0),
                                  Active = (((Boolean?)l.Active ?? false) ? 1 : 0)
                              });
            return Json(listValues.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
        public ActionResult HierarchyBinding_RegulatoryReference(int studyID, [DataSourceRequest] DataSourceRequest request)
        {
            var listValues =
                _context.StudyRegulatoryReferences.Where(l => (l.StudyID == studyID))
                        .OrderBy(l => l.RegulatoryReference);
            return Json(listValues.ToDataSourceResult(request));
        }

Adam
Top achievements
Rank 1
 answered on 13 Mar 2013
2 answers
223 views
I have this line of code
.ClientRowTemplate("#=kendo.toString(DtSundayOpenTime, \"hhmm\")#")
However I keep getting an invalid Template error. How can I format this to display only the time (12 or 24hr). Thanks
Dimiter Madjarov
Telerik team
 answered on 13 Mar 2013
1 answer
244 views

Hi here,

I'm building a web application with ASP.NET MVC4 and everything runs quite well so far. No I wanted to integrate Kendo UI to my _Layout.cshtml file in order to use some widgets. So I followed these steps (here) to include the neccessary scripts and styles, but when I run the project, it throws a JavaScript exception:

Unbehandelte Ausnahme in Zeile 17, Spalte 14133 in http://localhost:54430/Scripts/KendoUI/js/kendo.all.min.js
0x800a138f - Laufzeitfehler in JavaScript: Die Eigenschaft "msie" eines undefinierten oder Nullverweises kann nicht abgerufen werden.

When I comment out the reference to kendo.all.min.js everything works flawlessly. What can I do? I'm having a hard time telling my Boss that it actually was a good idea to spend more than thousand bucks on a bunch of tools that do not work. Please help me wih that!

Regards,
Rob

Here's my code:

(PS: I also tried adding a reference to kendo.aspnetmvc.min.js (one time before Kendo.all.min.js, another time behind it), but it didn't help.)

<!DOCTYPE html>
<html lang="de">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
 
    <title>@ViewBag.Title - © 2012 PINTSCH ABEN B.V.</title>
 
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
 
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/themes/base/css")
    <link href="/Scripts/KendoUI/styles/kendo.common.min.css" type="text/css" rel="stylesheet" />
    <link href="/Scripts/KendoUI/styles/kendo.default.min.css" type="text/css" rel="stylesheet" />
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    <header>
        <div class="content-wrapper">
            <div class="float-left">
                <section id="logins">
                    @Html.Partial("_LoginPartial")
                </section>
                <nav>
                    <ul id="menu">
                        <li>@Html.ActionLink("Startseite", "Index", "Home")</li>
                        <li>@Html.ActionLink("Info", "About", "Home")</li>
                        <li>@Html.ActionLink("Kontakt", "Contact", "Home")</li>
                    </ul>
                </nav>
            </div>
 
            <div class="float-right">
                <img src="~/Images/logo.jpg" />
                @*<p class="site-title">@Html.ActionLink("Ihr Logo hier einfügen", "Index", "Home")</p>*@
            </div>
 
        </div>
    </header>
    <div id="body">
 
        @RenderSection("featured", required: false)
        <section class="content-wrapper main-content clear-fix">
            @RenderBody()
        </section>
    </div>
    <footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>© @DateTime.Now.Year - PINTSCH ABEN WH-SYSTEMS</p>
            </div>
        </div>
    </footer>
    <script src="~/Scripts/KendoUI/js/kendo.all.min.js"></script>
    @RenderSection("scripts", required: false)
</body>
</html>
Dimo
Telerik team
 answered on 13 Mar 2013
1 answer
107 views
Error 5 'System.Web.Mvc.HtmlHelper<System.Collections.Generic.List<SOH.Common.Model.Patient>>' does not contain a definition for 'Kendo' and no extension method 'Kendo' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<System.Collections.Generic.List<SOH.Common.Model.Patient>>' could be found (are you missing a using directive or an assembly reference?) c:\VSProjects\SOH.Orthodontics\SOH.Orthodontics.Web.UI\Views\Patient\PatientResult.cshtml 5 8 SOH.Orthodontics.Web.UI

Really struggling with this error.  Please help!  Html.Kendo() in the razor view just is not recognised!  Argh!!

Added a reference to the dll and also added namespace to BOTH web.config files.  Sections below from both files.

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>


    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
Andrew Currie
Top achievements
Rank 1
 answered on 13 Mar 2013
3 answers
458 views
I have an ajax grid with several pages of data that I allow users to perform CRUD operations on using the InCell edit mode. However, if I change pages or ordering or manipulate the page in any way after making a change the default behavior is to discard changes. I've noticed that if I set .ServerOperations(false), I can navigate without losing my changes but I also lose the 'dirty mark' indicating that there have been changes. This is likely to cause users to navigate away from the page and lose those changes with no feedback from the page. While that can still happen with a dirty mark, the client has decided that they would prefer that any changes be saved prior to changing pages or filtering (basically, any of the _Read events).

What is the best way to enable a save operation prior to losing data in such a grid? 
Vladimir Iliev
Telerik team
 answered on 12 Mar 2013
1 answer
295 views
Hi,

I have to say, I wasted now really a lot of time in figuring out how the css styles are applied to the grid edit controls:

I did two tests:
1) Use the Kendo Grid with Javascript configuration
2) Use the grid with MVC Wrapper configuration

And I get different styles for the editors (e.g string editors) when doing that! After research, probably that's what explained here: 
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templates

In Version 1), the text boxes get the class "k.input k-textbox". Fine, that's what I want
In Version 2), the tet boxes get the class "text-box single-line". Why the difference?

Do I really have to declare editor templates now for every data type I want to edit? In that case, I could probably go on with the free Kendo edition and do not use the server wrappers. Why does it cause additional effort when I use them? Can someone explain?

Thanks!
Dimo
Telerik team
 answered on 12 Mar 2013
3 answers
126 views
Is it possible to have forced list matching similar to the ComboBox in the non-Kendo controls (http://demos.telerik.com/aspnet-mvc/razor/combobox/clientsidebinding) in the Kendo ComboBox? It seems there is no way to prevent the user from typing whatever they like into the input box.

This functionality also exists in the ASP.NET Ajax Combobox (http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/autocompleteclientside/defaultcs.aspx)
Georgi Krustev
Telerik team
 answered on 12 Mar 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?