Telerik Forums
UI for ASP.NET MVC Forum
4 answers
660 views
Hi,
I have put in a general error handling to handle exceptions and authorisation errors for all Ajax calls, both Kendo and my api. I send back status 500 of exception and 401, Forbidden, or 403, Unauthorized, for authorisation errors.

The problem is I do not seem to be able to prevent the dataSource from updating the display if I get a non-200, OK, response. Looking at the code in Chrome it does not call the function associated with 'databinding' on line 13 of the code below.
01.function kendoGridErrorHandler(args) {
02.    if (args.errors == undefined) {
03.        if (args.xhr.status == 403) {
04.            updatePrimaryMessage("You are not authorised to carry out that operation.", true);
05.        } else if (args.xhr.status == 401) {
06.            updatePrimaryMessage("You need to be logged in to carry out that operation.", true);
07.        } else if (args.xhr.status == 500) {
08.            updatePrimaryMessage("The operation did not complete because of an error.", true);
09.        } else {
10.            updatePrimaryMessage("There was problem. Please refresh the screen.", true);
11.        }
12.        $('#PrimaryKGrid').data().kendoGrid.one('dataBinding', function(e) {
13.            e.preventDefault();
14.        });
15.    } else {
16.        //error means Ajax error response. customerror means Kendo error response
17.        var grid = $('#PrimaryKGrid').data("kendoGrid");
18.        grid.one("dataBinding", function(e) {
19.            e.preventDefault(); // cancel grid rebind if error occurs
20.            //We have formatted errors to display
21.            for (var error in args.errors) {
22.                showMessage(grid.editable.element, error, args.errors[error].errors);
23.            }
24.        });
25.    }
26.}
Can you suggest what I have done wrong?

Thanks in advance.
Jon Smith
Top achievements
Rank 1
 answered on 14 Jun 2013
3 answers
804 views
I am migrating an application from release 2012.3.1114 to release 2013.1.319.  Previously, I was able to apply HtmlAttributes on columns in this manner:
@(Html.Kendo().Grid<ToolListItemView>().Name("texListGrid")
    .Columns(columns => {
        columns.Bound(m => m.ToolId);
        columns.Bound(m => m.Description).HtmlAttributes(new { style = "font-size: 1.3em;" });
        columns.Bound(m => m.LastModified);
        columns.Bound(m => m.ConditionName);
        columns.Bound(m => m.LocationName);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("ToolsRead", "List").Data("listParams"))
    )
)
With release 2013.1.319, an "invalid template" error is generated from the above code.  If I change HtmlAttributes to HeaderHtmlAttributes, no errors are generated and the style is applied to the column header (i.e. the format of the HtmlAttributes isn't a problem).  I did verify that I could use HtmlAttibutes on a column with an @class parameter successfully, which is the correct way of applying styles.  I guess I'm wondering if this capability (local CSS styling via HtmlAttributes) was intentionally removed, or if I'm doing something wrong?

Note: Moved from Kendo UI Web forum.
Dimo
Telerik team
 answered on 14 Jun 2013
1 answer
128 views
I have read several tutorials and have a few basic questions regarding mobile development and Kendo.
1.  I am building mobile apps with MVC 4 and VS 2012.  Do I only need to use Kendo Mobile UI or do I also use Kendo UI Complete for ASP.Net MVC?  What is the difference?
2.  I also want to use OpenAccess ORM, but do not understand where this integrates with Kendo UI Mobile (is there any good samples)?
3. This will be hosted via Azure websites, is there any gotchas before I moved forward?

Thanks for the help, I must admit it is not very clear which toolset to use at this point.
Jason
Alexander Valchev
Telerik team
 answered on 13 Jun 2013
4 answers
754 views
I have a combobox with over 100000 records, but it's unusable, it makes the browser very slow and unresponsive.

I'm using it like this:
@(Html.Kendo().ComboBox()
    .Name("ID_Poblacion")
    .DataValueField("Item1")
    .DataTextField("Item2")
    .DataSource(dataSource => dataSource // Configure the grid data source
        .Read(read => read.Action("Items", "Poblacion", new { Area = "DataAPI" }))
    )
    .Value(Model.ID_Poblacion.ToString())
)
I've also tried setting Autobind(false), but when I try to open the combobox it becomes unusable.

I've tried limiting the number of records returned, but once it's databoud, it seems it won't call the server method again no matter what I type in the box.

Any help on how to make the combobox usable with huge number of records?
Sergi
Top achievements
Rank 1
 answered on 13 Jun 2013
0 answers
121 views
Hi,
I implemented Kendo Grid helper in a MVC 4 with WebApi application, but I don't know how can I set de column list to change dinamically the rows that it shows.
My code:
@(Html.Kendo().Grid<Bitacora.WebUI.Models.WhiteBoard.XXXGridModel>()
            .Name("Grid")
            .AutoBind(true)
            .EnableCustomBinding(true)
            //.BindTo(Model.xxxx.YYYList)
            .Columns(c =>
            {
                c.AutoGenerate(column =>
                {
                    //customize autogenereted column's settings                                                    
                    column.Width = "150px";
                    
                    //column.ClientTemplate = "<input type='checkbox' name='checkbox' />";

                });
            })
            .Scrollable(scrolling => scrolling.Enabled(true).Height("auto"))
            .Resizable(x => x.Columns(true))
            .Events(events => events.Change("searchCalls"))
            .DataSource(dataSource => dataSource
                                                .Ajax()
                                                .Read(read => read
                                                   .Action("Search", "api/ActionApi")
                                                   .Data("getFiltersSelected")
                                                   .Type(HttpVerbs.Post))
                                                   .ServerOperation(true)) // Paging, sorting, filtering and grouping will be done server-side  
                                                //.ColumnMenu()
                                                .Selectable(selectable => selectable
                                                    .Mode(GridSelectionMode.Multiple))
                                                .Reorderable(reorder => reorder.Columns(true))
                                                .Groupable(grouping => grouping.Enabled(true))
                                                .Filterable(filterable => {filterable
                                                                            .Operators(operators => 
                                                                                        {operators.ForString(strFilter => strFilter.Clear().Contains("contains"));
                                                                                            operators.ForNumber(strFilter => strFilter.Clear());
                                                                                        });
                                                                            filterable.Extra(false);
                                                            }) //--> sólo se muestra el contains en las columnas Texto
            .Sortable(s=> s
                .SortMode(Kendo.Mvc.UI.GridSortMode.MultipleColumn)
                .AllowUnsort(true))
            .Pageable(pager => pager
                .Enabled(true)
                .Input(true)
                .PageSizes(new [] { 5, 10, 20, 30, 40, 50 })) // MULTIDIOMA RESOURCES

My Model:

 public class XXXGridModel
    {
        [Display(Name = "Id", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int Id { get; set; }
         [Display(Name = "DateCreated", ResourceType = typeof(WhiteBoardGridVMResource))]
        public DateTime DateCreated { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CallNumber { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string FileNumber { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string DUE { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdBranchOffice { get; set; }
         [Display(Name = "BranchOfficeName", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string BranchOfficeOfficeName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdCompany { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CompanyCompanyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdOffice { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string OfficeOfficeName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdShip { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string ShipShipName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdPort { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string PortPortName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdCallStatus { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CallStatusStatusName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int? IdOwner { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string OwnerThirdPartyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int? IdOperator { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string OperatorThirdPartyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int? IdInductor { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string InductorThirdPartyName { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public bool IsNominatorOwner { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public bool IsNominatorOperator { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public bool IsNominatorInductor { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public int IdCreatedBy { get; set; }
        [Display(Name = "Default", ResourceType = typeof(WhiteBoardGridVMResource))]
        public string CreatedByUserName { get; set; }
        }

Anyone can Help me?!
Thanks in advance
Ivan
Top achievements
Rank 1
 asked on 13 Jun 2013
1 answer
198 views
Is there a way to edit grid rows in a separate view. I need to accomplish this because the modal has too much information so it needs to be displayed in a separate view.

grid.bind("edit", function (e) {
                window.location = '@Url.Action("AddEditCoalition","Form",new{coalitionId=Model.CoalitionId})' + '&formId=' + e.model.Id;
});
The only problem is the modal shows up is there anyway to do this without the modal showing at all and it goes stratight to the seperate view?
Rosen
Telerik team
 answered on 13 Jun 2013
6 answers
1.1K+ views
Hi,
I'm trying to understand how to bind an action from the Db to the kendo menu. 
in all the demos I saw there is and Item.add().text().action("action","controller");

but if I bind to Db then I have:
Item.Text = "Some Text";

how should I attach the action method to the menu? (what should be the right side of the item.Action = ?)
I would also like your opinion as to the way to store it in the Db (if there is any best practice regrding this matter).

thank you
ShareDocs
Top achievements
Rank 1
 answered on 12 Jun 2013
0 answers
275 views
(the sample application that I wanted to attached is slightly above 2MB  after having removed binaries, etc... can I email it to someone for support?)

We have a requirement to drag data from multiple sources and drop it to a treeview. To illustrate the problem(s)...  I am including a VS 2012 Sample project that includes a destination treeview on the left side and another treeview and grid on the right side. The treeview on the left is populated from one database and the treeview and grid on the right from another. The goal is to copy (and not "move) data from one database (on the right) to the other (on the left).
The sample is based on the Northwind database.

I couldn't find solutions to many many problems so I just rather to provide a clean sample project so hopefully it can be completed (instead of creating multiple different support tickets). Other that some fragments of JavaScript I could not find any functional and practical sample fully implementing a typical drag and drop scenario on an MVC project with Kendo.

These are the needs which hopefully can be addressed on the provided sample app.:

1) We want to drag from the source treeview to the destination treeview... How can we configure the source treeview visual indicators so users know that they can "drag" but not "drop"on the (same) source treeview but on the treeview on the left?

2) How can we identify the parent node (the target) to which data is being dropped? (I tried the target and dropTarget field but got "undefined"). The other problem is that in our real application, for some reason when data is being  dragged from the grid we do not see any target information (all objects are "undefined").

3) The treeview is very smart and adds the dragged node automatically when dragging from one treeview to the other... However, it is not the case when dragging from the Grid. Can we get some code about how to accomplish this (even better... modify the sample)  so when dragging from the grid instead of a TreeView, the destination treeview behaves exactly the same (e.g. so it displays the same built-in visual effects when hovering between sibling nodes, a parent node or on a node that doesn't allow child nodes, 
etc..)

4) Since we had problems retrieving the destination treeview's targetNode, I could not go further and persist the dragged node to the database implementing an Ajax post to a controller action. It would be great to have that part.

5) The idea is to copy and not move data... How can we prevent Kendo to visually remove automatically the source node from the source treeview once it's been dragged out?


Basically... if someone can complete the sample so it allows transferring data from one Northwind database to another (using either the treeview or the grid on the right to the one on the left) it would be great

Alejandro
Top achievements
Rank 1
 asked on 12 Jun 2013
2 answers
349 views
Hi, I am new to the Kendo UI controls and am evaluating them for potential use in a new project. I am having difficulty getting unobtrusive validation to work for a numeric text box. On the same view, I am able to get unobtrusive validation to work for a Kendo date picker. I am at a loss to understand what I am missing from my MVC4 project. 

I have attached the source for my view, my model, my controller and the html output. I have also attached a screen grab of the unobtrusive validation working for the date picker and not the numeric text box.

Any help would be appreciated. Thanks!
Scott
Top achievements
Rank 1
 answered on 12 Jun 2013
5 answers
2.1K+ views

Hi,

Is it possible to find a node by id (clientside)?

Here is how we populate the treeview.

public JsonResult _AjaxLoading(string id)
{
IEnumerable nodes = from item in GetDirectorys()
where (id == null ? item.parent == "" : item.parent == id)
select new
{
id = item.directory,
Name = item.name,
hasChildren = item.aantal > 0,
};
return Json(nodes, JsonRequestBehavior.AllowGet);
}
Shruthika
Top achievements
Rank 1
 answered on 12 Jun 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
Security
ColorPicker
DateRangePicker
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
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?