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

I have a Kendo tree view with three levels. Please see the attached file MyTree.jpg.

I have a leaf node's with text value "CHINA".  I am not able to get the leaf node's parent node text. Please see the attached file ChromeOutput.jpg. 

Please advise why undefined is returned for below -

treeview.text(treeview.parent(treeview.findByText("CHINA")))

Regards, 
Manoj



Alex Gyoshev
Telerik team
 answered on 21 Jul 2014
1 answer
340 views
My company is considering purchasing several licenses of Kendo UI Professional and UI for ASP.NET MVC.  I am using MVC 5 and the latest version of UI for ASP.NET MVC.  I am working with hierarchical data.   I am attempting to create the TreeView in the _Layout view and populate it with urls or action links.

My current code:

In the _Layout View:

@Html.Partial("_ProductTree")

"_ProductTree" Partial View

@(Html.Kendo().TreeView().Name("ProductTree")
    .DataSource(d => d
        .Model(m => m
            .Id("ProductId")
            .HasChildren("Categories"))
    .Read(r => r.Action("_ProductTree", "Home")))
    .DataTextField("ProductName"))

Action Method:

        [ActionName("_ProductTree")]
        public JsonResult GetProductTree()
        {
            var products = _productBusinessService.GetProducts();

            var result = products.Select(c => new
            {
                c.ProductID,
                c.ProductName,
                Categories= c.Categories.Any()
            }).OrderBy(t => t.ProductName);

            return Json(result, JsonRequestBehavior.AllowGet);
        }

I am having a number of issues:

1.  When I expand a parent node that has children, the TreeView is hitting the action method and appending the entire tree to the child, instead of just displaying the children.
2.  I need to be able to nest the TreeView two-deep, for example Product > Category > Type.
3.  I am trying to figure out how to aggregate or project the data using LINQ to do a two-deep higherarchy.
4.  I tried turning off LoadOnDemand but that made the TreeView call the action method once for each record in the Product list.

I have tried inserting the TreeView Razor code directly into the _Layout view (not using a partial view).   I realize that I may need to move the action method into a base controller class and inherit it in every controller to stop it from appending the list to the parent node. If I cant get this working soon, I may have to either use Kendo UI Professional or an open source alternative.

Thank you in advance for your help!
















Wayne
Top achievements
Rank 1
 answered on 19 Jul 2014
1 answer
119 views
I've an MVC application where I am trying to upgrade from 2013.1.514 to 2014.2.716.  My application has a custom LESS file that on the last line imports Template.less.

However, it appears this file is no longer in the src folder.

Has it simply been replaced by theme-template.less or am I going to have to rebuild my theme as best I can from my old file?
Alex Gyoshev
Telerik team
 answered on 18 Jul 2014
1 answer
127 views
So I set up a simple Kendo Grid, which I want to use to batch edit in cells etc. However when I click Add New Record the site redirects me to http://localhost:52536/Tag/Tag_Read/10322?grid-mode=insert with a page displaying a text list (json?) of my db entries. The in cell editing also doesn't work at all. 
I'll post my view and controller below. 


View:

@model IEnumerable<HoldAndRelease.Models.Tag>


<br />
<br />
<br />
@(Html.Kendo().Grid(Model) //Bind the grid to ViewBag.Products
      .Name("grid")
      .Columns(columns =>
      {
          // Create a column bound to the ProductID property
          columns.Bound(tag => tag.TagID);
          columns.Bound(tag => tag.ProductionDate);
          columns.Bound(tag => tag.CodeDate);
          columns.Bound(tag => tag.Amount);
          columns.Command(cmd => cmd.Edit());

      })
      .ToolBar(toolbar =>
      {
          toolbar.Create();
          toolbar.Save();
      })
      .Pageable()
      .Navigatable()
      .Sortable()
      .Scrollable()
      .DataSource(datasource =>
          datasource
          .Ajax()
          .Batch(true)
          .PageSize(10)
          .ServerOperation(false)
          .Events(events => events.Error("error_handler"))
          .Model(model =>
          {
              model.Id(tag => tag.TagID);
              model.Field(tag => tag.TagID).Editable(false);
          })
          .Create(create => create.Action("Tag_Create", "Tag"))
          .Read(read => read.Action("Tag_Read", "Tag"))
          .Update(update => update.Action("Tag_Update", "Tag"))
          ).Editable(editable => editable.Mode(GridEditMode.InCell))
)

<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);
        }
    }
</script>

Controller:

public ActionResult Tag_Read([DataSourceRequest]DataSourceRequest request)
        {
            db.Configuration.ProxyCreationEnabled = false;
            IQueryable<Tag> tags = db.Tags;
            DataSourceResult result = tags.ToDataSourceResult(request);
            return Json(result, JsonRequestBehavior.AllowGet); 
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Tag_Create([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Tag> tags)
        {
            db.Configuration.ProxyCreationEnabled = false;
            var entities = new List<Tag>();
            if (ModelState.IsValid)
            {
                foreach (var tag in tags)
                {
                  
                    var entity = new Tag
                    {
                        ProductionDate = tag.ProductionDate,
                        CodeDate = tag.CodeDate,
                        Amount = tag.Amount
                    };

                    db.Tags.Add(entity);

                    entities.Add(entity);
                }

                db.SaveChanges();
            }

            return Json(entities.ToDataSourceResult(request, ModelState, tag => new Tag 
            {
                TagID = tag.TagID,
                ProductionDate = tag.ProductionDate, 
                CodeDate = tag.CodeDate,
                Amount = tag.Amount
            }), JsonRequestBehavior.AllowGet);
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Tag_Update([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Tag> tags)
        {
            db.Configuration.ProxyCreationEnabled = false;
            var entities = new List<Tag>();
            if (ModelState.IsValid)
            {
                foreach (var tag in tags)
                {
                    var entity = new Tag
                    {
                        ProductionDate = tag.ProductionDate,
                        CodeDate = tag.CodeDate,
                        Amount = tag.Amount
                    };

                    entities.Add(entity);

                    db.Tags.Attach(entity);

                    db.Entry(entity).State = EntityState.Modified;
                }
                
                db.SaveChanges();
            }

            return Json(entities.ToDataSourceResult(request, ModelState, tag => new Tag
            {
                TagID = tag.TagID,
                ProductionDate = tag.ProductionDate,
                CodeDate = tag.CodeDate,
                Amount = tag.Amount
            }), JsonRequestBehavior.AllowGet);
        }
Daniel
Telerik team
 answered on 18 Jul 2014
8 answers
676 views
I need to change a filterDescriptors member from FranchiseeName to Franchisee.Name.
Note that the field is "Name" from a related included table called Franchisee

so far I have
If request.Filters.Any() Then
              If request.Filters.Any(Function(y) CType(y, Kendo.Mvc.FilterDescriptor).Member.Equals("FranchiseeName")) Then
                  Dim filter As FilterDescriptor = request.Filters.Single(Function(g) CType(g, Kendo.Mvc.FilterDescriptor).Member.Equals("FranchiseeName"))
                  request.Filters.Add(New Kendo.Mvc.FilterDescriptor With {.Member = "Franchisee.Name", .Value = filter.Value.ToString})                      
                  request.Filters.Remove(filter)
              End If


but this does not work. It adds the descriptor and removes old descriptor as planed without error but query fails. 

in this post I see a simple field change can be achieved. but in my case this does not work.
http://www.telerik.com/forums/how-to-access-datasourcerequest-filters-in-controller-

Any ideas, Thanks
Alan Mosley
Top achievements
Rank 1
 answered on 18 Jul 2014
0 answers
132 views
The Windows Installer packages for the Q2 2014 release (v.2014.2.716) contain outdated TypeScript and VSDOC definitions.
The ZIP packages are not affected. Future service versions will be free of this defect.

Attached is the reference version from the ZIP versions.

Please accept our apologies for the caused inconvenience.
Kendo UI
Top achievements
Rank 1
 asked on 18 Jul 2014
3 answers
911 views
I have been using Kendo to drawing charts at the web client side.  However, sometimes I need draw chart on the server side(MVC project). E.g., I would like to generate a chart as image then send it in a report email. Can Kendo support generating chart all by server with C# code?  I find highchart have this feature http://www.highcharts.com/component/content/article/2-articles/news/52-serverside-generated-charts
Thanks in advance.
T. Tsonev
Telerik team
 answered on 18 Jul 2014
1 answer
395 views
In the example below, how can I restrict a user from entering more than 5 decimals in the textbox? 


@(Html.Kendo().NumericTextBox<decimal>()
 .Name("maxVarianceAmount")
 .HtmlAttributes(new { style = "width:75px" })
 .Format("c5")
 .Min(0)
 .Value(@ViewBag.MatchProcessor.VarianceAmount)
 .Decimals(5)
 .Spinners(false)
 ) 
Georgi Krustev
Telerik team
 answered on 18 Jul 2014
1 answer
123 views
We want to modify the default template of the popup mini calender/date calender of the kendo scheduler. How can we get the instance of this calender component within this scheduler ?
Vladimir Iliev
Telerik team
 answered on 18 Jul 2014
6 answers
118 views
Hi,

I just found a problem after I successfully loaded data from the controller.

The problem is clearly described in the attached picture.

Could anyone could help me solve this please?

Thanks and regards,

Charles
Blair
Top achievements
Rank 1
 answered on 17 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?