Telerik Forums
UI for ASP.NET MVC Forum
1 answer
134 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
1,000 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
105 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
175 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
77 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
350 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
117 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
3 answers
313 views
I have a grid defined as:-
@(Html.Kendo().Grid<WT_Portal_PMS2.Models.ClockStopsSummary>()
    .Name("StopGrid")
    .Columns(col =>
        {
            col.Bound(o => o.CurrentWaitingBand).Title("Weeks Waited").ClientFooterTemplate("Total");
            col.Bound(o => o.DNA).Title("DNA").ClientFooterTemplate("#= sum  #"); ;
            col.Bound(o => o.IP).Title("Admitted").ClientFooterTemplate("#= sum  #"); ;
            col.Bound(o => o.OP).Title("Non-Admitted").ClientFooterTemplate("#= sum  #"); ;
 
 
        })
       .ToolBar(tools => tools.Excel())
                   .Excel(excel => excel
                                    .FileName("ClockStopsSummary.xlsx")
                                    .Filterable(true)
                                    .AllPages(true)
                                    .ProxyURL(Url.Action("Excel_Export_Save", "IPWLDQ"))
                                    )
              
 
        .DataSource(ds => ds
        .Ajax()
                .Aggregates(ag =>
                {
                    ag.Add(p => p.DNA).Sum();
                    ag.Add(p => p.IP).Sum();
                    ag.Add(p => p.OP).Sum();
                })
        .PageSize(25)
                        .Model(m => m.Id(p => p.CurrentWaitingBand))
                  .Read(rd => rd.Action("_Table", "StopsAnalysis")
                       .Data("specFilter")
 
        )
        )
                
        .Sortable()
 
)


When I try to export the grid to Excel, a javascript error in kendo.all.min.js of 'Unhandled exception at line 578, column 7 in Function code0x800a138f - JavaScript runtime error: Object expected' is thrown.

If I remove the aggregate expressions, the export runs without a problem.  I see the demo example uses aggregates, but can't see any obvious differences. 
John
Top achievements
Rank 1
 answered on 12 Dec 2014
1 answer
1.2K+ views
I am trying to alter the meber name of a filterdescriptor but get error Unable to cast object of type 'Kendo.Mvc.CompositeFilterDescriptor' to type 'Kendo.Mvc.FilterDescriptor'  here

If request.Filters.Any(Function(y) CType(y, Kendo.Mvc.FilterDescriptor).Member.Equals("FranchiseeName")) Then
 
                     Dim filter As FilterDescriptor = CType(request.Filters.Single(Function(g) CType(g, Kendo.Mvc.FilterDescriptor).Member.Equals("FranchiseeName")), FilterDescriptor)
                     filter.Member = "Franchisee.Name"
 
 
                 End If

I don't know what the difference is or why I get this, I have done simular before without this problem.
Thanks

​
Rosen
Telerik team
 answered on 12 Dec 2014
2 answers
836 views
I have the grid defined below.  I need to be able to edit the Flag Notes column and post it back.  I have so far come up with 2 solutions that are close but don't quite fit the bill.  

#1 gives a textarea to edit in, and it works exactly how it should, except the textarea is always visible and not just when you click in the cell to edit it.  
#2 also works, it hides the text box until you click in it, and it will save the text entered.  The problem comes when double quotes are entered into the field.  then the text that is saved ends with the 'closing' ".  How do I get it to accept both single and double quotes?

#2 is really what we want with the added bonus of actually being able to save double quotes or at least prevent them, maybe replace them with singles

<div id="divSearchResults">
     
       @(Html.Kendo().Grid((IQueryable<CallListModel>)Model)
       .Name("grid")
       .Editable(ed => ed.Mode(GridEditMode.InCell))
       .Pageable()
       .Sortable()
       .Scrollable(a => a.Height("auto"))
       .Filterable()
       .DataSource(ds => ds.Ajax()
           .PageSize(Constants.MaxSearchReults)
           .Sort(sort => sort.Add("Name").Ascending())
           .ServerOperation(false)
           .Update(update => update.Action("SaveFlagComments", "Reports"))
           .Model(mod =>
               {
                   mod.Id(m => m.ID);
                   mod.Field(p => p.Zone).Editable(false);
                   mod.Field(p => p.Name).Editable(false);
                   mod.Field(p => p.CarrierCode).Editable(false);
                   mod.Field(p => p.Location).Editable(false);
                   mod.Field(p => p.DispatchPhone).Editable(false);
                   mod.Field(p => p.DispatchFax).Editable(false);
                   mod.Field(p => p.DispatchEmail).Editable(false);
               }))
       .Columns(columns =>
       {
          columns.Template(@<text></text>)
                   .ClientTemplate("<input type='checkbox' " + ViewBag.disable + 
                   "#= Contacted ? checked='checked':'' # class='chkbx' value='#= ID#' name='selectCarrier' />" +
                   "<input type='hidden' value='#= ID#' name='allCarriers' />")
                   .Width(25);
           columns.Bound(p => p.Zone).Filterable(false).Width(70);
           columns.Bound(p => p.Name).Filterable(false).Width(75);
           columns.Bound(p => p.CarrierCode).Filterable(false).Width(65);
           columns.Bound(p => p.Location).Filterable(false).Width(80);
           columns.Bound(p => p.DispatchPhone).Filterable(false).Width(70);
           columns.Bound(p => p.DispatchFax).Filterable(false).Width(70);
           columns.Bound(p => p.DispatchEmail).Filterable(false).Width(90);
           columns.Template(@<text></text>)
               .ClientTemplate(" <a href='" + Url.Action("Edit", "CarrierView", new { ID = "#=ID#" }) + "', target = '_blank' >Edit</a>").Width(30);
           columns.Bound(p => p.FlagNotes)
 #1              //.ClientTemplate("<textarea name='FlagNotes_#= ID#' cols='60' rows='3' style='height=100px'>#=FlagNotes#</textarea>")
 #2              .ClientTemplate("#=FlagNotes#<input type='hidden' name='FlagNotes_#= ID#' value=\"#=FlagNotes#\">")
               .Filterable(false).Width(120);
          // columns.Command(command => { command.Edit();}).Width(40);
       })
       )

   </div>
Paul Grothe
Top achievements
Rank 1
 answered on 11 Dec 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?