Telerik Forums
Kendo UI for jQuery Forum
2 answers
332 views
Hey everyone,

I am having Entity Framework Serialization Circular reference problems when attempting to bind to my Kendo UI grid. I found the documentation about how to deal with it here:

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting

Which led me to here:

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-avoid-circular-reference-exceptions?

I have now implemented that change on my controller and am passing an anonymous type collection to my view. However now at runtime, when I try to look at my page, it immediately throws an Exception stating

"CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type"

Below is a snippet from my grid and controller. Property3 is the one it is complaining about, which is the one I am using to bypass the object in my anonymous type collection.


The JSON is built up like the following:               

  var collection = result.ToDataSourceResult(request, c => new
                {
                       Property1 = c.Property1
                       Property2 = c.Property2
                       Property3 = c.EntityFrameworkObject.Property3
                       Property4 = c.Property4
                });               

return Json(collection, JsonRequestBehavior.AllowGet);



@(Html.Kendo().Grid<My.Namespace.To.My.EntityObject>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Property1);
columns.Bound(p => p.Property2).Width(100);
columns.Bound(p => p.Property3).Width(100);
columns.Bound(p => p.Property4.Width(100);
columns.Command(command => { command.Edit(); }).Width(160);
})

As far as I can tell, this follows the example given. Why am I getting this "CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type" error and what do I need to do to get rid of it?

The only other thing I can think of is to remove the "My.Namespace.To.My.EntityObject, because there is no "Property3" on that object, however the compiler complains if I don't specify a type in the <> . 

I am at a loss of how to move forward here.  

Dave
Top achievements
Rank 1
 answered on 22 May 2014
1 answer
304 views
Hey everyone

I have a Kendo grid set up with ".Editable(editable => editable.Mode(GridEditMode.PopUp) ) "

When I click the edit button in the grid , the screen pops up as normal. Properties are set correctly, however when I alter a property and save, I get the error below.

0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'data': object is null or undefined

This error is happening in the "Kendo.all.js" file. Here is the relevent javascript:

setup: function(options, type) {
options = options || {};

var that = this,
parameters,
----------------------------------------------------------------------------------------------------------------------------------------------------------
operation = that.options[type], //**** the operation gets set to 'Undefined' by this line and fails on the line below. *****/
-----------------------------------------------------------------------------------------------------------------------------------------------------------
data = isFunction(operation.data) ? operation.data(options.data) : operation.data;

options = extend(true, {}, operation, options);
parameters = extend(true, {}, data, options.data);

options.data = that.parameterMap(parameters, type);

if (isFunction(options.url)) {
options.url = options.url(parameters);
}

return options;
}

What is happening to cause this and how do I resolve it?

Thanks,

Dave


Dave
Top achievements
Rank 1
 answered on 22 May 2014
2 answers
1.0K+ views
I'm using the new Masked Textbox from Kendo UI for MVC and it actually works fine and binds into model without problems. One feature I didn't get automatically is the ability to press "Enter" key and submit my form.

Other textbox I use (Kendo().AutoComplete()) works fine with the "Enter" key.

@(Html.Kendo().MaskedTextBox()
.Name("PhoneNumber")
.Mask("(999) 000-0000"))
Georgi Krustev
Telerik team
 answered on 22 May 2014
1 answer
2.7K+ views
I really don't know How to reset datasouce  with Grid. I searched some materials, and some info said use setDataSource() method. It didn't work. I have no idea. please help me.
<button onclick="LoadPerson1()">Load User 1</button>
<button onclick="LoadPerson2()">Load User 2</button>
<div id="grid"></div>
 
<script>
    var personModel
    var grid;
    $(function () {
        personModel = {
            user: {
                ObjectId: "",
                PrincipalName: "",
                Userinfos: []
            }
        };
 
        grid = $("#grid").kendoGrid({
            toolbar: [
                { name: "create" },
                { name: "save" },
                { name: "cancel" }
            ],
            columns: [
                { field: "Key" },
                { field: "Value" }
            ],
            dataSource: personModel.user.Userinfos,
            editable: true
        }).data("kendoGrid");
    });
 
 
    function LoadPerson1() {
        $.ajax({
            cache: false,
            type: "post",
            dataType: "json",
            url: "Home/GetUser",
            success: function (data) {
                personModel.user.ObjectId = data.ObjectId;
                personModel.user.PrincipalName = data.PrincipalName;
                personModel.user.Userinfos = data.Userinfos;
 
                                                     //I really want to reset datasouce here, thanks
                grid.dataSource.data(personModel.user.Userinfos);
                grid.dataSource.read();
            }
        });
    }
 
    function LoadPerson2() {
        $.ajax({
            cache: false,
            type: "post",
            dataType: "json",
            url: "Home/GetUser2",
            success: function (data) {
                personModel.user.ObjectId = data.ObjectId;
                personModel.user.PrincipalName = data.PrincipalName;
                personModel.user.Userinfos = data.Userinfos;
                 
            }
        });
    }
</script>

above sentences are my all code. The pic I attach is data in personModel.user.UserInfos
Dimiter Madjarov
Telerik team
 answered on 22 May 2014
3 answers
581 views
    In WebAPI: 
        [HttpDelete]
        [Route("AccountDel")]
        public void DeleteAccount([FromBody]Account account)
        {
...

So I can't call that from a (Or could a put a jquery ajax call in there): 
                    destroy: {
                        type: "DELETE",
                        url: function (options) {
                            return '/api/FlossAccount/AccountDel';
                        },
                        dataType: "json",
                       data:  function (options) {
                            return { '': options.models[0]};
                         },
                        cache: false
                    },  



danparker276
Top achievements
Rank 2
 answered on 22 May 2014
8 answers
237 views
Whats the minimum browser requirements specifically for IE in order to run Kendo UI smoothly ?
Dimo
Telerik team
 answered on 22 May 2014
7 answers
198 views
Hi
  http://trykendoui.telerik.com/orod

  As you can see the editor doesn't appear to work on mobile, you can't enter any text and it looks odd.

(1) How can I fix this?
(2) I get the impression that the editor should work on mobile, does it?
(3) Are there any Web controls which don't work on mobile?

Is there any documentation about getting these Web controls to work on mobile or should it in general just work?

thanks
Kiril Nikolov
Telerik team
 answered on 22 May 2014
1 answer
108 views
I'm trying to use source binding to an observable array to enable the user to dynamically add new elements as required. My item template has a few hidden fields and a kendo ui editor. The editor is initialized with jQuery in the template. The problem, however, is that the editor is not being initialized properly after the view model has been bound.

I have created a jsBin showing the problem: jsBin

Notice that that editors for the initially-bound items are correctly initialized, but any added elements are not. If I unbind and re-bind the entire view model after each item is added then everything will work, but that seems like serious overkill. Any feedback would be appreciated.
Kiril Nikolov
Telerik team
 answered on 22 May 2014
1 answer
178 views
Hello,

the problem is validator is really slow(beacuse i have about 400 radio inputs - 130 radio button groups). Here is the code of the custom rule of the validator:

$("#testWizard").kendoValidator({
        rules: {
            radio: function (input) {
                     //if type radio and required attribute on the input
                if (input.is("[type=radio]") && input.attr("required")) {
                          //check if any radio button is selected from the radio button group
                    return $("#testWizard").find("[name=" + input.attr("name") + "]").is(":checked");
                }
                return true;
            }
        },
        messages: {
            radio: "Choose one of the items"
        }
    });

The best solution would be that validation code breaks when the first validation error is found. But i don't know how to achieve this.
Maybe any other suggestions?

Thanks

Kiril Nikolov
Telerik team
 answered on 22 May 2014
1 answer
142 views
Hi,

I have a few windows here: http://jsbin.com/manazohu/1/edit and they are draggable, the problem is that when I dragged the inner windows the outer one moved too. How can I make only the one I dragged move, and others stay still? Thanks.

Alex Gyoshev
Telerik team
 answered on 22 May 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Drag and Drop
Map
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?