Telerik Forums
UI for ASP.NET MVC Forum
1 answer
186 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
83 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
370 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
121 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
371 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
859 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
1 answer
104 views
Buenas Tardes amigos del foro disculpen por escribir en español, pero necesito ayuda de como crear un TreeView a partir de una consulta LinqToXML. Si me pueden facilitar un ejemplo en Visual Basic, estaría muy agradecido.
Daniel
Telerik team
 answered on 11 Dec 2014
1 answer
112 views
Hi there,
I've a Scheduler and a Grid, i want to update the schedule when someone create or update the items in the grid.

I've subscribed the sync event with: .Events(events => events.Sync("sync"))

then I update the scheduler:

 function sync(args) {
        $("#scheduler").data("kendoScheduler").dataSource.read();
        $("#scheduler").data("kendoScheduler").refresh();
}

it works, but if there is a server validation error the editor popup quits and the user can't see the validation error.
How can I detect a successfully update?

Server validation is implemented as in the example provided:

<script type="text/kendo-template" id="message">
    <div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error"
         style="margin: 0.5em; display: block; " data-for="#=field#" data-valmsg-for="#=field#" id="#=field#_validationMessage">
        <span class="k-icon k-warning"> </span>#=message#<div class="k-callout k-callout-n"></div>
    </div>
</script>


<script type="text/javascript">
    var validationMessageTmpl = kendo.template($("#message").html());

    function error(args) {
        if (args.errors) {
            var grid = $("#grid").data("kendoGrid");
            grid.one("dataBinding", function (e) {
                e.preventDefault();   // cancel grid rebind if error occurs

                for (var error in args.errors) {
                    alert(args.errors[error].errors);
                    showMessage(grid.editable.element, error, args.errors[error].errors);
                }
            });
        }
    }

    function showMessage(container, name, errors) {
        //add the validation message to the form
        container.find("[data-valmsg-for=" + name + "],[data-val-msg-for=" + name + "]")
                 .replaceWith(validationMessageTmpl({ field: name, message: errors[0] }))
    }

</script>



Daniel
Telerik team
 answered on 11 Dec 2014
1 answer
314 views
This is driving me crazy... I want to do some formatting on the cell that is housing the .k-event after the databound event is triggered.  However, it's triggered 3 times every time the page is loaded or I navigate to a new time.  Any idea why this is happening?

Rosen
Telerik team
 answered on 10 Dec 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?