Telerik Forums
UI for ASP.NET MVC Forum
9 answers
2.1K+ views
Hello!
I always get Error: GET ~/Scripts/kendo/2013.1.703/jquery.min.map 404 (Not Found)
I update Kendo to Q2 , but this error dosn't disappear
Atanas Korchev
Telerik team
 answered on 05 Sep 2013
1 answer
69 views
It seems like the objects are not being passed into listview editor templates at all now.

Latest internal build 2013.2.830.commercial
iCognition
Top achievements
Rank 1
Iron
 answered on 04 Sep 2013
10 answers
68 views
Hello,

there is a new exclusive IE8 bug in the 2013 Q2 release  which is easily reproduceable with the Online Kendo Demos.

If you change the "Font" Drop-Down (e.g: Heading 1, Heading 2), a javascript error occurs in "kendo.web.js":
Object doesn't support property or method 'indexOf'

Can you please put the fix in the next Internal Build.


Uriah
Top achievements
Rank 1
 answered on 04 Sep 2013
3 answers
206 views
I want to be able to select a row in a parent grid and be able to see (and edit or add) all of it's children. The parent is a lessor and the child is the leased equipment. I created a through away project where I get the expected behavior but when I implement it my real project it is not working. I have verified I am getting a JSON response back from my controller but the grid is not filling in with the data.

Here is my stripped down code from the razor view:


@using Cci.Web.PPDeclaration.Models


@(Html.Kendo().Grid<Cci.Web.PPDeclaration.Domain.DbEntities.Lessor>()
.Name("LeasingGrid")
.Columns(columns =>
{
columns.Bound(l => l.LessorId).Hidden(true);
columns.Bound(l => l.LessorName).Title("Lessor").Width(175);
}
)
.Selectable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetLessors", "Leasing"))
.Events(events => events.Error("error_handler"))
)
.Events(events => events.Change("change"))
)


@(Html.Kendo().Grid<Cci.Web.PPDeclaration.Domain.DbEntities.Lease>()
.Name("LeaseGrid")
.Columns(columns =>
{
columns.Bound(m => m.LeaseDetail).Width(250).Title("Property Description");
columns.Bound(m => m.LeaseNumber).Width(80).Title("Lease Number");
})
.AutoBind(false)
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("SelectLease", "Leasing").Data("data"))
.Events(events => events.Error("error_handler"))
)

)


<script type="text/javascript">

function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}

function change() {
$("#LeaseGrid").data("kendoGrid").dataSource.read();
}

function data() {
var grid = $("#LeasingGrid").data("kendoGrid");

return {
lessorId: grid.dataItem(grid.select()).LessorId
}

}
</script>


@section Javascript
{

<script src="@Url.Content("~/Scripts/kendo/2013.2.716/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
<script src="@Url.Content("~/Scripts/EditableGrids.js")"></script>
}

Here is the controller code:
public class LeasingController : System.Web.Mvc.Controller
{
private ILeasingRepository _repository;

public LeasingController() : this(new LeasingRepository())
{
}

public LeasingController(ILeasingRepository repository)
{
_repository = repository;
}

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

#region Lessors

public ActionResult GetLessors([DataSourceRequest]DataSourceRequest request)
{
LeasingModel model = new LeasingModel { Lessors = _repository.GetActiveLessors(SessionData.AccountNo) };
return Json(model.Lessors.ToDataSourceResult(request));
}

#endregion

#region leases
public ActionResult GetLeases([DataSourceRequest]DataSourceRequest request)
{
LeasingModel model = new LeasingModel { Leases = _repository.GetActiveLeases(SessionData.AccountNo) };
return Json(model.Leases.ToDataSourceResult(request));
 }

public ActionResult SelectLease([DataSourceRequest]DataSourceRequest request, int lessorId)
{
SessionData.LessorId = lessorId;
return Json(new[] { FilteredLeases() }.ToDataSourceResult(request, ModelState),JsonRequestBehavior.AllowGet);
}

private List<Lease> FilteredLeases()
{
return _repository.GetActiveLeases(SessionData.AccountNo).Where(ls => ls.LessorId == SessionData.LessorId).ToList();
}

#endregion

Any help will be appreciated.

Thanks,
Dave Brown

P.S. I've also attached the through away project.
Vladimir Iliev
Telerik team
 answered on 04 Sep 2013
1 answer
169 views
Hello,
I'm using KENDO UI grid in mvc4 application and following your tutorial for ajax binding I'm doing something  as

public ActionResult Products_Read([DataSourceRequest]DataSourceRequest request)
{
using (var northwind = new NorthwindEntities())
{
IQueryable<Product> products = northwind.Products;
// Convert the Product entities to ProductViewModel instances
DataSourceResult result = products.ToDataSourceResult(request, product => new ProductViewModel
{
ProductID = product.ProductID,
ProductName = product.ProductName,
UnitsInStock = product.UnitsInStock
});
return Json(result);
}
}

Now I need to add an export in PDF/csv function... I was wondering since you don't offer it out of the box to store a guid of the retieved data and pass it back to
the client...at the button click I'll pass this data back to the server and export the data if still present in cache otherwist I'll remake the call...
now I've tried adding a TempData["guid"] just before the Json(result) but with no luck.. should I change the binding method? and use a pure kendoui grid passing back an object as
Result { Guid ID {get;set; } IEnumerable<type> DataItems {get;set}} ?

Thanks
Petur Subev
Telerik team
 answered on 04 Sep 2013
1 answer
222 views
I inherited an MVC application that was using Kendo UI 2012.3.1114.  I am trying to upgrade the project to use 2013.2.716.  Using the library package manager in Visual Studio 2010, I downloaded the latest version of Kendo via Nuget.  The files seemed to load correctly into my project.  However I soon realized that the 2013.2.716 folder is missing a kendo.aspnetmvc.js file.  I'm assuming that this file is necessary for the project since it was included in the older version of the Kendo files.  (Not sure if this is related or not, but I noticed that the ListView templates are not working anymore.)  So in Visual Studio 2010 I used the Kendo UI for ASP.NET MVC Upgrade Wizard thinking that this tool would provide me with the updated script.  However instead this tool reinstalled the old version of Kendo into my project.  I've been searching on the site and forums trying to find out how to get the 2013.2.716 version of kendo.aspnetmvc.js but am having no luck.  Does anyone have any suggestions?
Missing User
 answered on 04 Sep 2013
1 answer
105 views
I need to select a panel bar on initial load. I do have a currently loaded item in JS variable.

How do I select an item on panel bar?
Kiril Nikolov
Telerik team
 answered on 03 Sep 2013
4 answers
119 views
I'm keen to integrate the Twitter Bootstrap framework in a project, to improve layout etc..

However, this seems to cause a few display issues with some of the Kendo UI controls, especially the pop-up edit window of the grid.

Attached are two screenshots of an edit window, with and without the inclusion of the bootstrap css and js files.

Here are the css/js inclusions in the _Layout.cshtml file:-
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
 
    <link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.bootstrap.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.dataviz.bootstrap.min.css")" rel="stylesheet" type="text/css" />
 <link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js")"></script>
          <script src="@Url.Content("~/Scripts/kendo/2013.2.716/cultures/kendo.culture.en-GB.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
<script src="@Url.Content("~/Scripts/bootstrap.min.js")"></script>
I'm using the Q2 2013 release (build 716) and the latest bootstrap 3 files, along with the KendoUI bootstrap theme. How can they be made to work together properly?

Thanks
Iliana Dyankova
Telerik team
 answered on 03 Sep 2013
6 answers
1.0K+ views

I have not been able to come across any documentation on how to "PASS" data from Razor View Drop Down Lists to My Controller or ActionLinks.


The Single DDL ( Drop Down List ) has been very successfull
  • Razor
  •   @(Html.Kendo().DropDownList()
                            .OptionLabel("Select Role...")
                            .Name("DDLRoles")
                            .DataTextField("RoleName")
                            .DataValueField("RoleID")
                            .BindTo(ViewBag.DDLRoles)                     
                            .AutoBind(true))
  • Controller [POST]
  • [HttpPost]
            [AcceptVerbs(HttpVerbs.Post)]
            public ActionResult ChangeRole(UserProfiles userprofiles, FormCollection values)
            {            
                
                string newRoleValue = values["DDLRoles"].Replace(",", "");
              
                string something2 = userprofiles.UserName;
FROM HERE DOWN IS THE CODE FROM CASCADING DROPDOWNLIST THAT ARE NOT WORKING.

What i would like to know is how to do this with ( Passing into [Post Controller] action ) cascading DDL and Possibly how to use this value in an ActionLink.

Here is my code:

  • Controller
  • using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.Entity;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using OG.ModelData;
    using OG.Models;
    using System.IO;
    using Newtonsoft.Json;

    namespace OG.Controllers
    {
        [Authorize(Roles = "PM,Administrator,CLS WebManager")]
        public class AddCCCTRSTController : Controller
        {
            private OilNGasDB db = new OilNGasDB();
               public ActionResult Index()
                {
                    return View();
                }
                public JsonResult GetCascadeClients()
                {
                    var clnts = db.Clients.Select(c => new { ClientID = c.ClientID, ClientName = c.Client }).ToList();
                    ViewBag.DDLclients = clnts;
                    return Json(db.Clients.Select(c => new { ClientID = c.ClientID, ClientName = c.Client }), JsonRequestBehavior.AllowGet);
                }
                public JsonResult GetCascadeCountys(int clients)
                {
                    var Countys = db.Countys.AsQueryable();

                    if (0 != clients)
                    {
                        Countys = Countys.Where(p => p.ClientID == clients);
                    }
                    return Json(Countys.Select(p => new { CountyID = p.CountyID, CountyName = p.County }), JsonRequestBehavior.AllowGet);
                }

                public JsonResult GetCascadeTownships(int countys)
                {
                    var townships = db.TownShips.AsQueryable();

                    if (0 != countys)
                    {
                        townships = townships.Where(o => o.CountyID == countys);
                    }

                    return Json(townships.Select(o => new { TownshipID = o.TownshipID, TownshipName = o.Township }), JsonRequestBehavior.AllowGet);
                }       
            
                [HttpPost] (THIS IS WHERE I'd LIKE TO RETURN DATA TOO FROM THE DDL's )
                [AcceptVerbs(HttpVerbs.Post)]
                public ActionResult Index(FormCollection values)
                {   
                    if (ModelState.IsValid)
                    {                    
                        string more3 = values["clients"];
                        string more4 = values["text"];
                        string more5 = values["DDLtracts"];
                        string more6 = values["tracts"];

  •                 // Return an empty string to signify success
                    return Content(more3 + more4 + more5 + more6);
                }
                else
                {
                    return Content("");
                }
            }


            protected override void Dispose(bool disposing)
            {
                db.Dispose();
                base.Dispose(disposing);
            }

        }
    }
  • RAZOR VIEW

  • <div class="demo-section">
        
        <div>             
                        <label for="clients">Client:</label>
                        @(Html.Kendo().DropDownList()
                              .Name("clients")
                              .HtmlAttributes(new { style = "width:300px"}) //, id = "clients"})
                              .OptionLabel("Select Client...")
                              .DataTextField("ClientName")
                              .DataValueField("ClientID")
                              .DataSource(source => {
                                   source.Read(read => {
                                       read.Action("GetCascadeClients", "AddCCCTRST");
                                   });
                              })
                            .Events(e => e
                                        .Select("dropdownlist_select")
                                        .Change("dropdownlist_change")
                                    )
                        )
                   
        </div>

        <div>            
                        <label for="countys">County:</label>
                        @(Html.Kendo().DropDownList()
                              .Name("countys")
                              .HtmlAttributes(new { style = "width:300px"}) //, id = "countys"})
                              .OptionLabel("Select County...")
                              .DataTextField("CountyName")
                              .DataValueField("CountyID")
                              .DataSource(source => {
                                  source.Read(read =>
                                  {
                                      read.Action("GetCascadeCountys", "AddCCCTRST")
                                          .Data("filterCountys");
                                  })
                                  .ServerFiltering(true);
                              })
                              .Enable(false)
                              .AutoBind(false)
                              .CascadeFrom("clients")
                        )
                        <script>
                            function filterCountys() {
                                return {
                                    clients: $("#clients").val()
                                };
                            }
                        </script>
        </div>
        
          
        <div>  
                       <label for="townships">Township:</label>
                        @(Html.Kendo().DropDownList()
                              .Name("townships")
                              .HtmlAttributes(new { style = "width:300px"}) //, id = "townships"})
                              .OptionLabel("Select Township...")
                              .DataTextField("TownshipName")
                              .DataValueField("TownshipID")
                              .DataSource(source => {
                                  source.Read(read =>
                                  {
                                      read.Action("GetCascadeTownships", "AddCCCTRST")
                                          .Data("filterTownships");
                                  })
                                  .ServerFiltering(true);
                              })
                              .Enable(false)
                              .AutoBind(false)
                              .CascadeFrom("countys")
                        )
                        <script>
                            function filterTownships() {
                                return {
                                    countys: $("#countys").val()
                                };
                            }
                        </script>
        </div>
        
          
        

    <script>
             $(document).ready(function () {
                $("#get").click(function () {

                    alert("$(document).ready(function ()")

                var clients = $("#clients").data("kendoDropDownList"),
                    countys = $("#countys").data("kendoDropDownList"),
                    townShips = $("#townShips").data("kendoDropDownList"),
                            
                    alert("$(''#get'').click(function ()")

                    var clientsInfo = "\nclients: { id: " + clients.value() + ", name: " + clients.text() + " }",
                        countysInfo = "\ncountys: { id: " + countys.value() + ", name: " + countys.text() + " }",
                        townShipsInfo = "\ntownShips: { id: " + townShips.value() + ", name: " + townShips.text() + " }",
                     

                        alert("Select Tract To Upload:\n" + clientsInfo + countysInfo + townShipsInfo);
            });
           });
    </script>


    @using (Html.BeginForm())
    {        
             <p>
  •             <input type="submit" value="ok" id="get" class="k-button"/>
            </p>
    }

     
If you need any more information please let me know thanks.

 


Don
Top achievements
Rank 1
 answered on 03 Sep 2013
1 answer
177 views
Hello,
I am trying to implement a menu that uses Images for the parent level and has a sub menu that contains text links.   The submenu text links are not showing.   My code is below - any help is greatly appreciated.

View
@(Html.Kendo().Menu()
         .Name("menuImagesNoText")
         .BindTo(Model, mappings =>
             {
                 mappings.For<WebConsole.Models.MenuItem>(binding => binding
                                                                         .ItemDataBound((item, category) =>
                                                                             {
                                                                                 item.ActionName = category.Action;
                                                                                 item.ControllerName = category.Controller;
                                                                                 item.ImageUrl = String.IsNullOrEmpty(category.ImageName) ? "": Url.Content(category.ImageName);
                                                                                 item.Selected = category.Selected;
                                                                                 item.ImageHtmlAttributes.Add("class", "sidebarImage");
                                                                             })
                                                                         .Children(category => category.MenuItems));
                 mappings.For<WebConsole.Models.MenuItem>(binding => binding
                                                                         .ItemDataBound((item, childcategory) =>
                                                                             {
                                                                                 item.Text = childcategory.LinkText;
                                                                                 item.ActionName = childcategory.Action;
                                                                                 item.ControllerName = childcategory.Controller;
                                                                             }));
             }).Orientation(MenuOrientation.Vertical).HighlightPath(false)
         )


Controller
public ActionResult Index(int selected)
     {
            var MainMenu = new Menu()
             {
                 MenuItems = new List<MenuItem>()
                         {
                             new MenuItem()
                                 {
                                     ImageName = "~/Images/home_orange.gif",
                                     LinkText = "DASHBOARD",
                                     Controller = "Home",
                                     Action = "Index",
                                     Ordinal = 1,
                                     Selected = true
                                 },
                             new MenuItem()
                                 {
                                     ImageName = "~/Images/new_white.gif",
                                     LinkText = "NEW WORK ITEM",
                                     Controller = "Home",
                                     Action = "Index",
                                     Ordinal = 2,
                                     Selected = false,
                                     MenuItems = new List<MenuItem>()
                                         {
                                             new MenuItem()
                                                 {
                                                     LinkText = "NEW INCIDENT",
                                                     Controller = "Home",
                                                     Action = "Index",
                                                     Ordinal = 1,
                                                     Selected = false
                                                 },
                                             new MenuItem()
                                                 {
                                                     LinkText = "NEW CHANGE REQUEST",
                                                     Controller = "Home",
                                                     Action = "Index",
                                                     Ordinal = 2,
                                                     Selected = false
                                                 },
                                             new MenuItem()
                                                 {
                                                     LinkText = "NEW SERVICE REQUEST",
                                                     Controller = "Home",
                                                     Action = "Index",
                                                     Ordinal = 3,
                                                     Selected = false
                                                 }
                                         }
                                 },
                             new MenuItem()
                                 {
                                     ImageName = "~/Images/team_white.gif",
                                     LinkText = "MY TEAM'S WORK ITEMS",
                                     Controller = "Home",
                                     Action = "Index",
                                     Ordinal = 3,
                                     Selected = false
                                 },
                             new MenuItem()
                                 {
                                     ImageName = "~/Images/my_white.gif",
                                     LinkText = "ALL MY WORK ITEMS",
                                     Controller = "Home",
                                     Action = "Index",
                                     Ordinal = 4,
                                     Selected = false
                                 }
                          };
         
         return PartialView(MainMenu.MenuItems);
     }
Generated HTML
<ul id="menuImagesNoText" class="k-widget k-reset k-header k-menu k-menu-vertical" data-role="menu" tabindex="0" role="menubar">
     <li class="k-item k-state-selected k-state-default k-first" role="menuitem">
     <a class="k-link" href="/">
         <img class="k-image sidebarImage" src="/Images/home_orange.gif" alt="image">
      </a>
      </li>
    <li class="k-item k-state-default" role="menuitem">
        <a class="k-link" href="/">
           <img class="k-image sidebarImage" src="/Images/new_white.gif" alt="image">
           <span class="k-icon k-i-arrow-e"></span>
           </a>
         <ul class="k-group" role="menu" aria-hidden="true">
              <li class="k-item k-state-default k-first" role="menuitem">
                  <a class="k-link" href="/"></a>
                   </li>
              <li class="k-item k-state-default" role="menuitem">
                  <a class="k-link" href="/"></a>
                     </li>
              <li class="k-item k-state-default k-last" role="menuitem">
                  <a class="k-link" href="/"></a>
                    </li>
             </ul>
       </li>
</ul>
Daniel
Telerik team
 answered on 03 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?