Telerik Forums
UI for ASP.NET MVC Forum
1 answer
118 views
I would like to create sub total rows and group header rows for Monthly and Yearly totals and counts. I have a date field and a payment field. I can't see any way of doing this without creating extra columns in my data. Is there an example that works with dates that is available anywhere?


Thanks,


Larry
Petur Subev
Telerik team
 answered on 17 Dec 2014
1 answer
288 views
I am trying to use the TreeList widget (http://demos.telerik.com/kendo-ui/treelist/index), but with a lot of data (~2000 rows). It seems to not handle this well as it tries to load all everything at once. 

There is a similar TreeView widget (http://demos.telerik.com/kendo-ui/treeview/index), which allows for a configurable method called “LoadOnDemand” (http://docs.telerik.com/kendo-ui/api/javascript/ui/treeview#configuration-loadOnDemand) that allows the children for a node to be loaded when the parent is expanded, but I can't seem to find a similar function for the treelist widget. 

Is there an alternative way to achieve the same functionality (loading the children on expand of their parent)?

Nikolay Rusev
Telerik team
 answered on 17 Dec 2014
3 answers
397 views
Hi,

We're using numeric textboxes in a grid that allows for keyboard navigation.  The problem is that the up/down arrows still increase and decrease the values in the textbox before the navigation event occurs.  Is there a way to disable the default key events, or modify them?

Thanks,
Kevin
Georgi Krustev
Telerik team
 answered on 17 Dec 2014
1 answer
128 views
Hi Team,

I am displaying a pie chart in ASP.Net MVC.

.Series(series =>
        {
            series.Pie(new dynamic[] {
                new {category="Forms Created",value=Model.value1,color="#9de219"},
                new {category="Forms Allowed",value=Model.value2,color="#50dd48"}

            })
.Tooltip(tooltip => tooltip
            .Visible(true)
                    .Template("#= category # - #= kendo.format('{0}', value)#")
        )

Now the tool tip is displaying the value of corresponding category.

I would like to display value of (category 1 value - category 2 value) in my tool tip.


Could you advise is this is possible to format in kendo?

Thanks.
Hristo Germanov
Telerik team
 answered on 16 Dec 2014
1 answer
986 views
I have a multiselect in a form on a pop up window and I finally got the initial value(s) from the model showing when the window opens, but now when there is an initial value, the select list does not work.  I click in the field - no list.  It shows the list when I click in the field and there is no initial value and my placeholder text is showing.  I need help please!  I've added code below and attached screen shots.

Here is my code for the multiselect list:
<div class="form-group">
    @Html.Label("User Role(s)")
    @{
        (Html.Kendo().MultiSelectFor(model => model.SelectedRoles)
            .Name("SelectedRoles")
            .HtmlAttributes(new {style = "width: 400px"})
            .Placeholder("Please select role(s)...")
            .DataTextField("Name")
            .DataValueField("Id")
            .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Url("/api/gmcmembership/roles").Type(HttpVerbs.Get);
                });
            })
            .Value(Model.SelectedRoles)
            .AutoBind(false)
            ).Render();
    }
</div>

Here is the code for the Models:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace GMCWebApplication.Areas.admin.Models
{
    public class UserDetailViewModel
    {
        [HiddenInput]
        public string Id { get; set; }
        public int CompanyCode { get; set; }
        public string UserType { get; set; }
        public int Question1 { get; set; }
        public int Question2 { get; set; }
        public string Question1Answer { get; set; }
        public string Question2Answer { get; set; }
//        public string PasswordHash { get; set; }
        public string PhoneNumber { get; set; }
        public string NewPassword { get; set; }
        public List<UserRoleViewModel> SelectedRoles { get; set; }
        public List<UserRoleViewModel> AllRoles { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace GMCWebApplication.Areas.admin.Models
{
    public class UserRoleViewModel
    {
        public string Id { get; set; }
        public string Name { get; set; }
    }
}

Here's the api code to get the list of all roles:

[System.Web.Http.HttpGet]
[System.Web.Http.Route("roles")]
public IHttpActionResult GetRoles()
{
    try
    {
        var list = new List<UserRoleViewModel>();
        using (var context = new ApplicationDbContext())
        {
            list = context.Roles.Select(p => new UserRoleViewModel { Id = p.Id, Name = p.Name })
                                 .ToList<UserRoleViewModel>();
        }
        return Ok(list);
    }
    catch (Exception ex)
    {
        Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
        return InternalServerError();
    }
}

Any help is very much appreciated!

Donna
Donna Stewart
Top achievements
Rank 1
 answered on 16 Dec 2014
1 answer
104 views
I'm trying unsuccessfully to set different tool-tips for different series.

I want some series tool-tips to be visible but others not. It seems that the visibility of the tool-tip on the last series determines the visibility of the tool-tips on ALL series. Does it have to be this way or am I doing something wrong.

.Series(series => { series.Donut(Model.Data.Bands.Where(b => b.ID == 1).First().Sections); }).Tooltip(t => t.Visible(true))
.Series(series => { series.Donut(Model.Data.Bands.Where(b => b.ID == 2).First().Sections); }).Tooltip(t => t.Visible(false))                           

The above hides the tool-tips on both series.
Iliana Dyankova
Telerik team
 answered on 16 Dec 2014
1 answer
173 views
Hi:
Can you tell me where localStorage["kendo-grid-options"]  ends up storing the grid settings information?
Thanks
Robert.
Kiril Nikolov
Telerik team
 answered on 16 Dec 2014
1 answer
75 views
hi 
the following code works fine in firefox but not in google chrome and IE10

iam trying to hide set of columns after grid is loaded with content
iam getting  Uncaught TypeError: Cannot read property 'style' of undefined from ui.DataBoundWidget.extend.hideColumn

iam using the same method on another grid and it works fine on all browsers
can u tell me whats wrong with this
please look at my attachments...

thank u all
Alexander Popov
Telerik team
 answered on 13 Dec 2014
1 answer
343 views
Hi there. Yesterday, I have updated my MVC project to Telerik UI for ASP.NET MVC 2014.3.1119. I was updating from version 2014.2.1008. However, several javascript errors appear, and some basic functionality is not working.

I will provide two examples of malfunctioning I ran into.

1. Pagesizes:
@(Html.Kendo().Grid(Model)
      .Name("ServiceGrid")
      .Pageable(action => action.Enabled(true)
                .ButtonCount(8)
                /*.PageSizes(new[] {25, 100, 500}) TODO this yields an error in the current Telerik */
                .Refresh(true))
      .DataSource(data => data
              .Ajax()
          .Events(events => events.Error("grid_onError"))
          .Model(model =>
          {
              model.Id(m => m.Name);
          })
          .Read(read => read.Action("Get", "Service"))
          .Group(g => g.Add(f => f.Host))
      )
      .Columns(column =>
      {
          column.Bound(ci => ci.FriendlyName).Title("Service");
          column.Bound(ci => ci.Host).Hidden();
          column.Bound(ci => ci.Status);
          column.Command(cmd => cmd.Custom("Restart Service").Click("onClickRestartService")).Width(120).Title("Actions");
      }))

The commented out line shows what was functioning correctly in version 2014.2.1008, but isn't anymore in 2014.3.1119. This JS error appears when I uncomment the code:
Uncaught TypeError: undefined is not a function
kendo.web.min.js:11 ht.extend.pageSize
jquery-2.1.1.js:7328 (anonymous function)
jquery-2.1.1.js:375 jQuery.extend.each
jquery-2.1.1.js:139 jQuery.fn.jQuery.each
jquery-2.1.1.js:7320 jQuery.fn.extend.val
kendo.web.min.js:20 u.extend.init
kendo.web.min.js:29 ut.ui.DataBoundWidget.extend._pageable
kendo.web.min.js:28 ut.ui.DataBoundWidget.extend.initkendo.web.min.js:10 (anonymous function)

When I click on the error, Chrome leads me to this place in the kendo.web.min.js code:
pageSize:function(e){var n=this;return e!==t?(n._query({pageSize:e,page:1}),t):n.take()},sort
(with the cursor positioned at 'n._query')

2. Export to Excel
I wanted to add the new 'Export to Excel' functionality to most of my grids. I have added the required method to my Controller, and have added the two relevant code snippets to the Razor grid code (the toolbar part and the the Excel-part with the ProxyURL, fileName and filterable).

The button appears correctly, however, when I click it, this JS error appears in the console:
Uncaught TypeError: undefined is not a function
kendo.dataviz.min.js:12 ht.extend.success
kendo.dataviz.min.js:12 n.trigger.n.online.n.transport.read.success
kendo.dataviz.min.js:11 n.success
jquery-2.1.1.js:3073 fire
jquery-2.1.1.js:3185 self.fireWith
jquery-2.1.1.js:8251 done
jquery-2.1.1.js:8598 (anonymous function)

When I click the error, the console leads me to this JS part in kendo.dataviz.min.js:
a._pristineData=e.slice(0),a._detachObservableParents()
(more specifically, at 'slice').

My gut feeling tells both these errors have the same cause.
I have made sure the version is updated completely by using kendo.version(), and by checking the served file headers in the Chrome developer tools.
I would be very glad if someone could point me in the right direction..
Daniel
Telerik team
 answered on 13 Dec 2014
2 answers
114 views
Hi there, it's my first time trying to do a search result binding using ASP.NET MVC + ListView. I have included the source codes below. Please let me know if there is anything I should modify, and what I need to do to get it to work.

1. Search Form
01.<div class="content-wrapper">
02.    <div class="search-wrapper">
03.        @using (Html.BeginForm("Search", "Home", FormMethod.Post, new { id="search-form" }))
04.        {
05.            <div class="search-top-panel">
06.                <input id="tbKeywords" name="tbKeywords" type="text"
07.                       class="k-textbox" style="width: 600px; font-size: 24px;"
08.                       required validationmessage="Enter a keyword"
09.                       placeholder="Enter a Keyword" />
10.            </div>
11.            <div class="search-bottom-panel">
12.                <div class="search-bottom-left-panel">
13.                    @Html.ActionLink("Advance Search Options", "Index", "Home", new { search="adv" }, new { @class="standard-link" } )
14.                </div>
15.                <div class="search-bottom-right-panel">
16.                    @(Html.Kendo().Button().Name("btnSearch").Content("Hit It!").HtmlAttributes(new { type = "submit", @class = "k-primary" }))
17.                </div>
18.            </div>
19.        }
20.    </div>
21.</div>

2. Backend Code
01.[HttpPost]
02.public ActionResult Search()
03.{
04.    ViewBag.Keywords = Request.Form [ "tbKeywords" ];
05. 
06.    VideoRepository videoRepository = new VideoRepository ( );
07. 
08.    List<string> keywords = new List<string> ( );
09. 
10.    keywords = Request.Form [ "tbKeywords" ].Split ( new char [ ] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries ).ToList ( );
11. 
12.    IList<Video> lstResults = new List<Video>();
13. 
14.    IList<Video> videos;
15.     
16.    foreach(string keyword in keywords)
17.    {
18.        videos = videoRepository.GetAll ( ).Where ( v => v.VIDEO_TITLE.Contains ( keyword ) || v.VIDEO_DESC.Contains ( keyword ) ).ToList ( );
19. 
20.        foreach(Video v in videos)
21.        {
22.            if ( !lstResults.Contains ( v ) )
23.                lstResults.Add ( v );
24.        }
25.    }
26. 
27.    ViewBag.Results = lstResults;
28. 
29.    return RedirectToAction ( "Index", new { view = "results" } );
30.}

3. ListView
01.@if (Request.QueryString["view"] == "results")
02.{
03.    <div class="ui-memberVideolist" style="width: 100%;">
04.        @(Html.Kendo().ListView<TheWebDevChannel.Models.VideoManagement.Video>(ViewBag.Results)
05.            .Name("lvMemberVideoList")
06.            .TagName("div")
07.            .ClientTemplateId("template")
08.            .Pageable()
09.        )
10.    </div>
11.}

I do recognize that my list view is incomplete code, because I am not exactly sure what else is required.
Sherman
Top achievements
Rank 2
 answered on 13 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?