Telerik Forums
UI for ASP.NET MVC Forum
9 answers
172 views
I seem to have hit an issue with paging after upgrading to the latest version of kendo.

It happens with ajax and server binding.  It appears that the filter data for the data source passes undefined values, which results in a 500 error on the server when it tries to bind to the filter values.  If I apply a filter, paging starts to work again.

(server binding example)

Grid Code
 @(Html.Kendo()
                .Grid(Model.Items)
                .Name("operatorList")
                .DataSource(ds => ds.Server())
                .Columns(columns =>
                    {
                        columns.Bound(c => c.Name);
                    })
                    .Filterable()
                    .Pageable())

Action
 public ActionResult Index()
        {
            var vm = new LookUpIndexViewModel<T>();
            vm.Recent = GetRecentlyActive();
            vm.Items = All();
            return View(vm);
        }

Url Requested (when paging)
http://localhost/browse/operator?operatorList-sort=&operatorList-page=2&operatorList-pageSize=15&operatorList-group=&operatorList-filter=undefined~undefined~undefined

Scripts Included (in this order)
<script src="/scripts/kendo.all.js"></script>
<script src="/scripts/kendo.aspnetmvc.js"></script>
doulbe checked versions also both say: v2013.2.716

Stack Trace
[NullReferenceException: Object reference not set to an instance of an object.]
Kendo.Mvc.Infrastructure.Implementation.FilterNodeVisitor.Visit(PropertyNode propertyNode) +60
Kendo.Mvc.UI.DataSourceRequestModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +465
Kendo.Mvc.UI.Grid`1.ProcessDataSource() +395
Kendo.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) +1145
Kendo.Mvc.UI.WidgetBase.ToHtmlString() +105
Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() +19
System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, Object content) +57
CtrlDev.Wdb.Web.Areas.Browse.Views.Operator.Index.Execute() in f:\Projects\CtrlDev.WDB\CtrlDev.Wdb.Web\Areas\Browse\areas\browse\views\operator\Index.cshtml:26
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +124
System.Web.WebPages.StartPage.ExecutePageHierarchy() +142
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +103
RazorGenerator.Mvc.PrecompiledMvcView.Render(ViewContext viewContext, TextWriter writer) +951
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +377
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +32
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +236
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1725
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +560

Found this question on SO, not sure if it is related, but it sounds like it.

Any help would be greatly appreciated!

Thanks!
Josh
Joar
Top achievements
Rank 1
 answered on 19 Sep 2013
1 answer
320 views
I am having trouble getting Paging to work while using the DataSource option on a Kendo UI Grid, using MVC wrappers.   

When I comment out the DataSource code, paging works just fine. 
When I use the DataSource option, it gives me a 404 "not found" error when I try to move to another page.

See the attached screenshots for my code.  One screenshot is the .cshtml file.   The other is the Controller.

Can anyone please help?
Brian
Top achievements
Rank 1
 answered on 18 Sep 2013
1 answer
369 views
I have a ajax bound grid with master / detail. Having problems getting the detail grid to refresh after saving an update. The data is saving correctly, you can see it update after i force the action method of the controller to be called by doing a sort. For that reason, i thought reading the datasource again from a client side event handler for the save event would do the trick. 

Here's my client detail template in the view:

<script id="matchedTrainTemplate" type="text/x-kendo-template">
    
     
    @(Html.Kendo().Grid<CNX.Domain.Entities.MatchedT94EDI417Railcar>()
            .Name("MatchingEDI417s_#=Id#")
            .Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w => w.Modal(true)
                                                                               .Width(500)
                                                                               .Height(510)
                                                                               .Resizable(x => x.Enabled(true))
                                                                               //.Events(x => x.Close("ClosingEditWindow"))
                                                                               )  )
          .Columns(columns =>
            {               
                columns.Bound(o => o.MATCHING_GUID).Visible(false);
                columns.Bound(o => o.N7_GUID).Visible(false);
                columns.Bound(o => o.EDI_OWNER_CODE).Width("50");
                columns.Bound(o => o.T94_OWNER_CODE).Width("50");
                columns.Bound(o => o.EDI_EQUIPMENT_NUMBER).Width("75");
                columns.Bound(o => o.T94_EQUIPMENT_NUMBER).Width("75");
                columns.Bound(o => o.EDI_GROSS_WEIGHT).Width("75");
                columns.Bound(o => o.EDI_TARE_WEIGHT).Width("75");
                columns.Bound(o => o.T94_SEQUENCE_NUMBER);
                columns.Command(commands => { commands.Edit(); }).Title("Edit Railcar").Width("50");            
                columns.Bound(o => o.RREGUID).Visible(false);
                columns.Bound(o => o.EDI_417_GUID).Visible(false);
                columns.Bound(o => o.HeaderGuid).Visible(false);
            })
            .DataSource(dataSource => dataSource.Ajax()
                                                .PageSize(10)
                                                .Model(model => model.Id(o => o.MATCHING_GUID))
                                                .Read(read => read.Action("MatchedEDI417sDetail", "MenuEDI", new { matchingGuid = "#=Id#" }).Type(HttpVerbs.Post))                                               
                                                .Update(update => update.Action("MatchedEDI417sUpdate", "MenuEDI" , Model).Type(HttpVerbs.Post))                                               
            )
            .Pageable()
            .Sortable()
            .Filterable()
            .Events( events => events.Save("detailSave"))
            .ToClientTemplate()
    );
 
    
 
</script>
 
<script>  
 
    function detailSave() {
        alert('Save Event');
        this.dataSource.read();
    }
</script>
Here's the controller action method:

[HttpPost]
        public ActionResult MatchedEDI417sUpdate(MatchedT94EDI417Railcar railCar, [DataSourceRequest] DataSourceRequest request)
        {
            TempData["role"] = GetRole();
            matchedT94EDI417RailCarRepository.Save(railCar);                 
                   return Json(matchedT94EDI417RailCarRepository.RailCarsMatchedT94EDI417(railCar.MATCHING_GUID).ToDataSourceResult(request));                
            
        }

Any suggestions appreciated.
Matt Miller
Top achievements
Rank 1
 answered on 18 Sep 2013
1 answer
89 views
Hi,

I would like the listview control to populate the querystring as it does with the Gridview control when I followed the custom binding example: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/custom-binding
This is because I need to allow the user to be able to bookmark the current listview result page
I am requiring the ListView control rather than the Gridview due to the formatting I am applying to each item
Please could you advise how this may be achieved? 

Many thanks,
Petur Subev
Telerik team
 answered on 18 Sep 2013
0 answers
93 views
Hello,

i cannot enter digits after the decimal separator in the UI, apparantly it works in IE10 but not in IE9 and FF
(the version is use is Kendo UI v2013.2.716)

culture is set to "en-US" via web.config globalization

<globalization culture="en" uiCulture="en-US"/>


this is info in the header of the page

       <link rel="stylesheet" href="/assets/styles/kendo.common.min.css" type="text/css" media="all" />
        <link rel="stylesheet" href="/assets/styles/kendo.metro.min.css" type="text/css" media="all" />
        <link rel="stylesheet" href="/assets/css/screen.css" type="text/css" media="all" />
   
        <script type="text/javascript" src="/assets/js/jquery.min.js"></script>
        <script type="text/javascript" src="/assets/js/kendo.all.min.js"></script>
        <script type="text/javascript" src="/assets/js/kendo.aspnetmvc.min.js"></script>
        <script type="text/javascript" src="/assets/js/cultures/kendo.culture.en.min.js"></script>
        <script type="text/javascript" src="/assets/js/cultures/kendo.culture.en-US.min.js"></script>
       
        <script type="text/javascript">
            kendo.culture("en-US");
        </script>

this is the .net code for generating the input element (.net datatype is decimal)

<td>@(Html.Kendo().NumericTextBoxFor(s => s.QuantitativeCost.AdditionalInformation.PaymentToRetailersForEWaste).Decimals(2).HtmlAttributes(new { style = "text-align:right;" }).Spinners(false).Enable(!Model.QuantitativeCost.IsCompleted).Deferred())</td>

can you help me out ? i'm i missing something ?

kind regards,
i.deeds nv
Top achievements
Rank 1
 asked on 18 Sep 2013
5 answers
178 views
I am using Kendo Grid for ASP.NET MVC in Server Edit mode. The grid is bound to a List<ModelObject>. I am using a Popup Editor. For the popup editor I am using a custom template. The ModelObject has some properties that should be loaded only when editing (lazy load). I have looked for samples but did not find how I can do lazy loading.

Are there any samples I can look at to get some ideas?

Thank you
Dimiter Madjarov
Telerik team
 answered on 18 Sep 2013
6 answers
395 views
I have a grid which columns are dynamically created on runtime. The grid renders fine, but I cannot resize the grid columns in Internet Explorer 8, because the resize handle icon is not shown. There is no problem in IE 9 or in any other browser.

When I use a static grid (column are defined in the razor view) the column resizing works fine also in IE 8. So the combination of dynamic grid columns and IE 8 causes the bug.

Here is the code I use in my razor View to define the dynamic grid:
@{
    string controller = ViewContext.GetCurrentController();
    string action = ViewContext.GetCurrentAction();
    string methodName = "_GetNewGridRows" + "_" + action;
 
    WFObjectListViewModel objectListViewModel = Model;   
}
 
@(Html.Kendo().Grid(objectListViewModel.ObjectDataList)
    .Name("Grid_" + objectListViewModel.UniqueID)
    .Columns(columns =>
    {
        columns.Bound(c => c.ID)
            .Hidden(true)
            .Title("wfID");
 
        columns.Bound(c => c.AspSite)
            .Hidden(true)
            .Title("aspSite");
 
        for (int i = 0; i < objectListViewModel.FolderColumns.Count; i++)
        {
            var id = i;
            var itemAttributesId = id + 2;
 
            if (objectListViewModel.FolderColumns[i].Type == "text")
            {
                string template = null;
                 
                if (Model.FolderColumns[i].ColumnName == "subject")
                {
                    string wfID = "\"#=ItemAttributes[" + 0 + "]#\"";
                    string aspSite = "\"#=ItemAttributes[" + 1 + "]#\"";
                    string jsOpenWindow = "javascript:openWindow(" + wfID + ", " + aspSite + ")";
                     
                    template = string.Format("<a href='{0}' style='white-space: nowrap;'>{1}</a>", jsOpenWindow, "#=ItemAttributes[" + itemAttributesId + "]#");
                }
                else
                {
                    template = string.Format(Model.FolderColumns[id].Template, "#=ItemAttributes[" + itemAttributesId + "]#");
                }
                                 
                columns.Bound(c => c.ItemAttributes)
                        .ClientTemplate("#=gridClientTemplate(Unread, 'begin')#" + template + "#=gridClientTemplate(Unread, 'end')#")
                        .Title(Model.FolderColumns[id].ColumnDisplayName)
                        .Hidden(Model.FolderColumns[i].Hidden)
                        .Column.Member = Model.FolderColumns[id].ColumnUniqueName;
 
            }
            else if ((Model.FolderColumns[id].Type == "image") || (Model.FolderColumns[id].Type == "deadline") || (Model.FolderColumns[id].Type == "bit"))
            {                  
                int columnWidth = 22 + (Model.FolderColumns[id].ColumnDisplayName.Length * 5);
                columns.Bound(c => c.ItemAttributes)
                    .ClientTemplate("#=gridClientTemplate(Unread, 'begin')#" + string.Format(Model.FolderColumns[id].Template, "#=ItemAttributes[" + itemAttributesId + "]#") + "#=gridClientTemplate(Unread, 'end')#")
                    .Title(Model.FolderColumns[id].ColumnDisplayName)
                    .Width(columnWidth)
                    .Hidden(Model.FolderColumns[i].Hidden)
                    .Column.Member = Model.FolderColumns[id].ColumnUniqueName;
            }
        }
    })
    .EnableCustomBinding(true)
    .DataSource(dataSource => dataSource.Ajax()
        .Read(read => read.Action(methodName, controller, new { folderID = Model.FolderID, searchFilterJson = ViewData["hiddenSearchFilter_Data"] }))       
        .PageSize(Model.EntriesPerPage)
        .Total(Model.TotalItems)
    )
    .Sortable(sorting => sorting.SortMode(GridSortMode.MultipleColumn))
    .Selectable()
    .Scrollable()   
    .Resizable(resizing => resizing.Columns(true))
    .Events(events => events.DataBound("onObjectDataListBound_" + controller + "_" + action))
    .Pageable(pageing => pageing.Enabled(true).Refresh(Model.AllowGridRefresh).Input(true).Numeric(false).PreviousNext(true).PageSizes(new int[] {3, 5, 10, 15, 25, 50, 75, 100 }))
)

Any idea how I can get the resizing handle shown when I move over the columns in IE 8? Updating to IE 9 is not a solution for me, because the customer is forced to use IE 8. Thanks.
Daniel
Telerik team
 answered on 18 Sep 2013
0 answers
85 views
I'm just posting this here for all the Kendo UI/MVC newbies out there...
If you copy and past the code snippet from http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/datepicker/overview, you will get a compilation error about missing parentheses.
Delete all the comments and it will run fine.
Pauline
Top achievements
Rank 1
 asked on 18 Sep 2013
1 answer
1.1K+ views
Please see the attached screenshot.

This only happens when we have both the virtual scrolling and the height set and then we filter.  It doesn't always happen, usually only after filtering on multiple columns.
@(Html.Kendo().Grid<BulletinModel>()
                .Name("Grid")
                .Editable(ed => ed.Mode(GridEditMode.PopUp).Window(w => w.Width(950)))
                .Selectable()
                .Scrollable(scrollable => scrollable.Virtual(true))
                .Sortable()
                .HtmlAttributes(new { @style = "height: 600px;" }))
Is there any way around this behavior?  Maybe setting the scrollable height on one of the containers?
Dimo
Telerik team
 answered on 17 Sep 2013
4 answers
283 views
Hello,

I have some troubles about resources in scheduler, so I come here to find some help.
I want to make a scheduler for some employees. For a better readability, I would like that every user's event has a unique color. Colors are stored in database, on with all User's data. So I decided to use Resources to do this.

However, when I define a remote loading for resources, then scheduler raise on error (see below) and stop working.
Here is Razor code :

@(Html.Kendo().Scheduler<EventViewModel>()
          .Name("calendar")
          .Date(DateTime.Now)
          .Timezone("Etc/UTC")
          .Views(v =>
          {
              v.DayView();
              v.WeekView(conf => conf.Selected(true));
              v.MonthView();
              v.AgendaView();
          })
          .DataSource(source => source
              .Model(conf =>conf.Id(f => f.EventId))
              .AutoSync(true)
              .Read("GetAllEvents", "Activity")
              .Create("CreateEvent", "Activity")
              .Destroy("DestroyEvent", "Activity")
              .Update("UpdateEvent", "Activity")
          )
        .Resources(resources => resources.Add(m => m.Creator)
            .Title("User")
            .DataTextField("Name")
            .DataValueField("UserId")
            .DataColorField("Color")
            .DataSource(source => source
                .Read(read => read.Action("GetUsersList", "Activity"))))
)

If I remove .Resources() part, all is working great. Defining some static resources (with .BindTo(new[]{...})) works well too, but this way is not handy.
Finally, when I want to define a resources section with remote loading, I got the following error messages in FireFox :

TypeError: t is undefined @ /Scripts/kendo/2013.2.716/kendo.all.min.js:31
TypeError: n.slice is not a function @ /Scripts/kendo/2013.2.716/kendo.all.min.js:11


Users list is perfeclty loaded in my page. Here is GetUsersList() code :
public ActionResult GetUsersList([DataSourceRequest] DataSourceRequest request)
{
    var items = from x in db.Users
                        select new {x.UserId, Name = x.FirstName + " " + x.LastName, x.Color};
    return Json(items.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}

One thing I notice is that, when resources are loaded up, scheduler does not trigger any loading for events. I'm not yet used to scheduler helper, so it's not really easy to understand what issue is.

Thanks you for your help.

Best Regards,
Claude
Claude
Top achievements
Rank 1
 answered on 17 Sep 2013
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
Wizard
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?