Telerik Forums
UI for ASP.NET MVC Forum
1 answer
220 views
Sorry if this has been covered somewhere, but I'm new to Kendo and am having trouble finding examples and/or documentation on this.

Basically I'm trying to figure out how to leverage a LinqtoSql entity framework in a .NET MVC application to handle edits/updates/deletes to my database with a Kendo Grid. I'm coming from an AJAX .NET webforms (so not even MVC!) world where tying a .NET grid to a LinqDataSource was pretty much all you needed to handle CRUD operations.

Thanks!
Petur Subev
Telerik team
 answered on 25 Jul 2013
6 answers
104 views
Hi, 
    I am trying to render a different partial view based on a property of the model. I will then need to pass the model from the current enumeration to the Html.RenderPartial called in the template 

as below i need to pass the current model from the edit to the RenderPartial i.e. "themodel".  How do I get the syntax to pass the model to it?

Thanks 

@using Assessments.Models;
@model IEnumerable<FallsAssessment>
 
@{
    ViewBag.Title = "FallsAssessmentList";
}
 
<h2>FallsAssessmentList</h2>
@Html.Kendo().Grid(Model).Name("FallsAssessments").Columns(columns=>
    {
        columns.Bound(m => m.AssessmentType).Title("Assessment Type");
        columns.Bound(m=> m.Ward).Title("Ward");
        columns.Bound(m=>m.LastUpdated_TS).Title("Last Updated");
        columns.Bound(m => m.LastUpdatedBy).Title("User");
        columns.Bound(m => m.Score);
        columns.Command(m => m.Edit().Text("Edit"));
    }
    ).ToolBar(t=>t.Create()).DataSource(d=>d.Ajax()
        .Model(
            model=>
                {
                    model.Id(id=>id.EventID);
                    model.Field(field=>field.EventID).Editable(false);
                }).Create("Create", "FallsAssessment").Update("Update", "FallsAssessment")).Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("edit-template"))
               
 
              FallsAssessmentFallsAssessmentFallsAssessment
 
<script id="edit-template" type="text/x-kendo-template">
#if(AssessmentType=='Child'){#
@Html.RenderPartial("AdultAssessment",themodel)
#}else{#
@Html.RenderPartial("AdultAssessment", themodel)
#}
</script>
Daniel
Telerik team
 answered on 25 Jul 2013
1 answer
561 views
I am following the Using Kendo UI with MVC4 WebAPI OData and EF article.  After installing KendoUI and making sure all references are set, I type in three characters, and get the following error:
  • Uncaught TypeError: Object #<Object> has no method 'slice'
I cleaned up kendo.web.min.js and the error is occuring around line 3498:
success: function (n) {
     var i = this,
         r = i.options;
     return i.trigger(wt, {
         response: n,
         type: "read"
     }), n = i.reader.parse(n), i._handleCustomErrors(n) ? (i._dequeueRequest(), t) : (i._pristine = et(n) ? e.extend(!0, {}, n) : n.slice ? n.slice(0) : n, i._total = i.reader.total(n), i._aggregate && r.serverAggregates && (i._aggregateResult = i.reader.aggregates(n)), n = i._readData(n), i._pristineData = n.slice(0), i._data = i._observe(n), i._addRange(i._data), i._process(i._data), i._dequeueRequest(), t)

The Kendo UI widgets are loading just fine as well as the css:

<link href="~/Content/kendo/kendo.common.min.css" rel="stylesheet" />
<link href="~/Content/kendo/kendo.default.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.9.1.min.js"></script>
<script src="~/Scripts/kendo/kendo.web.min.js"></script>
<script src="~/Scripts/kendo/kendo.aspnetmvc.min.js"></script>
<script src="~/Scripts/appScripts.js"></script>
And I am seeing the same error both with using the Razor MVC helper/extension:

@(Html.Kendo().AutoComplete()
    .Name("userAutoComplete")                   // specifies the "id" attribute of the widget
    .DataTextField("USERNAME")
    .DataSource(source =>
        {
            source.Read(read =>
                {
                    read.Url("/api/user");
                })
                  .ServerFiltering(true);       // if true, the DataSource will not filter the data on the client
        }
    )
)
and through directly through JS:

/// <reference path="kendo/kendo.aspnetmvc.min.js" />
/// <reference path="kendo/kendo.core.min.js" />
/// <reference path="kendo/kendo.autocomplete.min.js" />
/// <reference path="kendo/kendo.web.min.js" />
 
$(document).ready(function () {
    // load up KendoUI
     
    // gets data from /api/user
    var dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: "/api/user"
            }
        }
    });
 
    $("#userSearch").kendoAutoComplete({
        dataSource: dataSource,
        dataTextField: "USERNAME",
        minLength: 3
    });
 
    $("#userSearch").on('input', function () {
        console.log($("#userSearch").val());
    });
 
}); // $(document).ready()


I'm sure this is something simple that I may be missing.  I have tried both with the web and all js files.

Any assistance would be appreciated.


Thanks.

B
Top achievements
Rank 1
 answered on 24 Jul 2013
1 answer
82 views
Hello again,
The grid,supports to double-click the column header margins,and resize automatically to its longest value?
,something like is in the windows Explorer and you see the files in Detail format.

Regards,
Daniel
Dimiter Madjarov
Telerik team
 answered on 24 Jul 2013
5 answers
487 views
I am having difficulty working out how to add a Date picker to the Grid ToolBar in order that I use it to filter a large data set (500,000+ reords).

The documentation for showing how to do this for Kendo UI doesn't translate easily to MVC warpper versions.
Vladimir Iliev
Telerik team
 answered on 24 Jul 2013
1 answer
122 views
Hello,

I am new to KendoUI MVC .... I want to do create a Kendo UI MCV grid just  like Telerik Grid demo   : Client-Side Insert/Update/Delete

Please see the attachment - I appreciated all your helps

Thanks,
Ann
Vladimir Iliev
Telerik team
 answered on 24 Jul 2013
2 answers
60 views
Hello,

the following bug only occurs in IE 8 and is only reproduceable with IE 8. It is not reproduceable, if you switch your browser to IE 8 mode (via IE Toolbar). So please use a "real" IE 8 browser to reproduce:

OK, here is the bug:
If you add the first row to an empty grid (grid is in batch mode) it is working fine. After you inserted the new row, the grids renders the first cell in edit mode. Now if you add another row, the cell automatically switches from edit-mode to display mode. This occurs for every new grid row > 1.

It also seems, that the bug is connected when using custom Editor Templates (UIHint property set to reference to a custom editor grid cell template). For example I created a simple EditorTemplates that renders the Kendo Auto-Complete Textbox when the grid cell is in edit mode.

Do you have any ideas what can cause the bug in IE 8, or do you need a sample application to reproduce the bug?
BigzampanoXXl
Top achievements
Rank 1
 answered on 24 Jul 2013
2 answers
61 views
Hello,

it seems a new has been introduced with the 2013 Q2 release. With Release 2013 Q1 SP it worked fine.

I have a ajax grid and have the "Member" property set on the columns, so I will know which column was clicked for sorting when reaching the ajax read method on the controller.
Here is a snippet of the razor view where I have set the "Member" property on the columns:
columns.Bound(c => c.ItemAttributes)
                       .ClientTemplate("#=gridClientTemplate(Unread, 'begin')#" + template + "#=gridClientTemplate(Unread, 'end')#")
                       .Title(Model.FolderColumns[id].ColumnDisplayName)
                       .Hidden(hiddenColumn)
                       .Width(240)
                       .Column.Member = Model.FolderColumns[id].ColumnUniqueName;
When I click on a the header of the column the Ajax Read Method is called. Now the problem is, that I always get "undefined" instead of the clicked Column-Name in the request.Sort[INDEX].Member property. Please take a look at the attached screenshot.

This is a very serious bug in the 2013 Q2 release, cause I can't do the column sorting anymore. Please try to fix that bug as soon as possible in one of the next Internal Builds.
If you need any more infos, just tell me. Thanks.
BigzampanoXXl
Top achievements
Rank 1
 answered on 24 Jul 2013
3 answers
169 views
I have a very complex Model which has multiple objects some of them are lists.
for example :
Data.MylistObject[0].StatusID

when I pass

var name =  ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty);

@Html.Kendo().ComboBox().Name(name)

on the page html the 

jquery that creates the combo will look like :

jQuery(function(){jQuery("#Data.MylistObject[\\0\\]_StatusID.kendoComboBox

but jscript code refrencing the combo written in @ 
$('[name=@id].data('kendoComboBox')

is translatet to this code on the page

$('[name=Data.MylistObject_0__StatusID].data('kendoComboBox')

this inconsistency causes the code that is ment to taggle the options.filter paramenter to stop working due to the fact that the combo is not selected due to the difference in names.

the only way I found arround this is to pass  the id to the name property @Html.Kendo().ComboBox().Name(id)

and use 

$('#@id].data('kendoComboBox')

which works , there seems to be a problem with the way kendo parse [0] part of the member name.

Yours,

Ariel




Daniel
Telerik team
 answered on 24 Jul 2013
1 answer
72 views

Hello,

I am creating a menu and I am trying to get the LAST item to float right,
as you can see in my code, I am setting the last item HTMLAttributes @class to float right but it is not repsecting that.

What can I do to fix it.

@(Html.Kendo().Menu().Name("Menu")
            .Items(items =>
                {
                    items.Add().Text("Clear Jobs")
                        .Items(i =>
                            {
                                int days = ViewBag.LogDetailDays;
 
                                i.Add().Text("Clear jobs created more than " + days + " days ago")
                                    .Action("Jobs_DeleteLast", "Jobs")
                                    .HtmlAttributes(new { onclick = "return confirm('Are you sure you want to clear jobs?');" });
                                i.Add().Text("Clear all jobs")
                                    .Action("Jobs_DeleteAll", "Jobs")
                                    .HtmlAttributes(new { onclick = "return confirm('Are you sure you want to clear jobs?');" });
                            });
 
                    items.Add().ImageUrl("~/Images/refresh.png")
                         .Url("~/Jobs.html")
                         .HtmlAttributes(new { onclick = "refreshGrid()",
                                               @class = "float-right",
                                               title = AdminUI.RefreshButton_Tooltip })
                                               .Url("#");
                })
    )
Dimo
Telerik team
 answered on 24 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?