Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.4K+ views
Using the ASP.NET MVC Wrapper, how do I specify an object for the OptionLabel (as opposed to just a simple string)?
Dimo
Telerik team
 answered on 27 Dec 2013
1 answer
520 views
Hello. 
IQueryable extension method ToDataSourceResult currently creates query like
myQuery.Where(x=>x.SearchField.Contains(searchString))
 when using Contains operator.

 Unfortunately I'm using no-sql database RavenDb and its linq provider doesn't support contains method. Instead it offers extension for IQueryable called Search.
So when doing full-text search I should write myQuery.Search(x=>x.SearchField, searchString) instead Where clause. That's why I'm curious is there any opportunity to override default predicate builder?
Right now I'm doing it so (it's very basic implementation):
        public static IQueryable<TEntity> ApplyFiltering<TEntity>(this IQueryable<TEntity> queryable, IList<IFilterDescriptor> filters) where TEntity:class
        {
            foreach (var filter in filters.Cast<FilterDescriptor>()){
                  
                var pe = Expression.Parameter(typeof(TEntity), "x");
                var left = Expression.Property(pe, typeof(TEntity).GetProperty(filter.Member));
                queryable = queryable.Search(Expression.Lambda<Func<TEntity, object>>(left, new ParameterExpression[] { pe }), filter.Value.ToString());
            }
            filters.Clear();
 
            return queryable;
        }
 
//And controller code:
 
        public ActionResult Data_Read([DataSourceRequest] DataSourceRequest request)
        {
                var query = repository.GetQueryable();
                query = query.ApplyFilters(request.Filters);
                return Json(query.ToDataSourceResult(request));
        }
Is it correct workaround? Or there is more obvious solution that I couldn't find in docs?
Atanas Korchev
Telerik team
 answered on 27 Dec 2013
2 answers
119 views
Hello All,

I am a new Kendo user and hoped to get a few comments on an issue I am having utilizing an EditorTemplate in my Grid. Basically I have a bound column in my grid that displays the data just fine in Read Mode. Once I bring the Grid to Edit Mode, and call the EditorTemplate, the column that is supposed to display a dropdown, will display a textbox with the text [object Object], and no EditorTemplate dropdown ...

I have submitted a Support Ticket and have gotten some great help. After submitting some code, I even received a mock up project based on my code that works. Cool! However, even after copying the working code into my project, I still see the error. Kendo tech support  stated : "most probably the issue is related to the current Routing configuration in your real setup."

I have asked for more clarification on "Routing configuration "in my support ticket, but was hoping to get some feedback from any users who may have experienced a similar issue. Any comments appreciated.

Thanks,

Carl
Carl
Top achievements
Rank 1
 answered on 26 Dec 2013
1 answer
92 views
We have used KendoUI grid (v2013.2.918) control in our application with Detail template. We observe that when rows selection changes it is taking time to get the row selected.
Is there a known issue with the performance of selecting grid rows in IE (11, 10, 9)?
While it is working fine in other browsers (Chrome, Firefox etc).
Do we need to handle anything specific? Please suggest.

Thanks
Raj


Dimo
Telerik team
 answered on 24 Dec 2013
1 answer
119 views
Hi Team,

We have used KendoUI grid control in our application with Detail template. During testing, we found that there are performance issues in Windows XP with IE8 browser. Data binding/loading in IE 8 browser take more time than compared to other browsers (IE9, Chrome etc. - almost more than double time).

Also observed that when the grid is loaded with more than 500 records the entire application becomes non responsive.
Do we need to handle anything specific? Please suggest. 

This is bit urgent for us since client machines are Win XP.

Thanks,
Raj

Kiril Nikolov
Telerik team
 answered on 24 Dec 2013
2 answers
1.1K+ views
Hello,
I am newbie in telerik kendo UI. I start with list view and I don't have a clue how to pass some data during item creation. My scenario: I have some Types.  Each type has some groups. For each typeI want to create List View with  some groups. I used sample List View editing and have some questions:

- where Can I find information about different types of client template. I mean this markups because in samples there is only string display, and convert to string with some format

- how can I pass TypeID during Item Creation

My editor template code:
@model CustomFieldsGroup
 
@using (Html.BeginForm())
{
 
    @Html.HiddenFor(x => x.GroupID)
    @Html.HiddenFor(x => x.TypeID)
 
    <ul>
        <li>
            @Html.LabelFor(x => x.GroupName)
        </li>
        <li>
            @Html.EditorFor(x => x.GroupName)
        </li>
    </ul>
 
    <div class="edit-buttons">
        <a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-update"></span>Save</a>
        <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span>Cancel</a>
    </div>
}
My Type ID is always 0. When I am editing group Type ID is populated.

List View:
<div class="k-toolbar k-grid-toolbar">
    <a id="addRoleButton" class="k-button k-button-icontext k-add-button test" href="\\#"><span class="k-icon k-add"></span>Add new group</a>
</div>
 
<script type="text/x-kendo-tmpl" id="customFieldTemplate">
    <div class="product-view k-widget">
        <div class="edit-buttons">
            <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span></a>
            <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span></a>
        </div>
        <div>
            Group Name
        </div>
        <div>
            ${GroupName}
        </div>
        @*<dl>
                <dt>GroupName</dt>
                <dd>${GroupName}</dd>
                <dt>Unit Price</dt>
                    <dd>#:kendo.toString(UnitPrice, "c")#</dd>
                    <dt>Units In Stock</dt>
                    <dd>#:UnitsInStock#</dd>
                    <dt>Discontinued</dt>
                    <dd>#:Discontinued#</dd>
            </dl>*@
    </div>
</script>
 
<div class="fields">
    @(Html.Kendo().ListView<CustomFieldsGroup>(Model.Groups)
        .Name("listView")
        .ClientTemplateId("customFieldTemplate")
        .TagName("div")
        .DataSource(datasource =>
            datasource.Model(model=>
                {
                    model.Id(x => x.GroupID);
                    model.Field(x => x.TypeID).Editable(false);
                    model.Field(x => x.GroupName);
                })
            .Read(ac => ac.Action("Index_Read", "CustomFields"))
            .Create(ac => ac.Action("CreateGroup", "CustomFields"))
            .Update(ac => ac.Action("EditGroup", "CustomFields")))
        .Editable())
    )
</div>
 
<script>
    $(function () {
        var listView = $("#listView").data("kendoListView");
 
        $(".test").bind("click", function (e) {
            listView.add();
            e.preventDefault();
        })
    })
</script>

 
Marek
Top achievements
Rank 1
 answered on 23 Dec 2013
4 answers
120 views
Dear KendoUI Team!
It looks like there is a bug in the actual Version (2013.3.1119) of KendoUI that didn't exist in older versions. Nested Tables are not possible any more.
To reproduce this issue:
- Upgrade the demo project AjaxHierarchyEditing to Version 2013.3.1119 using the Upgrade wizard.
- Try to open any Detailsorder table. You will receive a javascript error in "e.execScript||function(t){e.eval.call(e,t)})(t)" The Read_OrderDetails method will not be called.
I am using VS2010 und IE 10.
So, my question:
- Is there a fix or a workaround? If not, when will it be available?

brgds
Malcolm Howlett.
Malcolm
Top achievements
Rank 1
 answered on 23 Dec 2013
1 answer
228 views
Hi, I'm having an issue with inline editing, create with the kendo grid. 
When I click on the "edit" button in the grid, instead of the row turning into edit mode, I am redirected to a bank view with Json data. The same thing happens when I click on the "create" button in the grid. If it helps to know, this view is actually a partial view that is injected via ajax and It displays fine..

I have tried a lot of different things, like checking that I have the required JS libraries, tweaking the grid configurations in my view, etc... 
I'm sure there is something really small that is causing this behavior and I would appreciate it if anybody can help me with this..

The view:
@model IEnumerable<TOPS.IQ.ViewModels.Administration.WebInfoVM>
 
    @(Html.Kendo().Grid<TOPS.IQ.ViewModels.Administration.WebInfoVM>(Model)
                .Name("grid")
                .HtmlAttributes(new { style = "height: 280px;" })
                .DataSource(dataSource =>
                    dataSource.Ajax()
                            .Read(read => read.Action("EditingInlineWebInfo_Read", "Administration", new { id = Model.FirstOrDefault() == null ? 0 : Model.First().CommunityID }))
                            .Model(model => model.Id(m => m.WebInfoID))
                            .Create(update => update.Action("EditingInlineWebInfo_Create", "Administration"))
                            .Update(update => update.Action("EditingInlineWebInfo_Update", "Administration"))
                            .Destroy(update => update.Action("EditingInlineWebInfo_Destroy", "Administration"))
                             
                    )
                .Columns(columns =>
                {
                    columns.Bound(p => p.WebInfoTypeName);
                    columns.Bound(p => p.Email);
                    columns.Bound(p => p.Description);
                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
                })
                 
                 
                .ToolBar(toolbar => toolbar.Create())
                .Editable()
                .Pageable()
                .Sortable()
                .Scrollable()
                 
                 
 )

The Controller actions:

public JsonResult EditingInlineWebInfo_Read([DataSourceRequest] DataSourceRequest request, int id)
       {
           //get the web infos for the given community
           var webInfos = _service.FindAll<Community_Webaddress>().Where(c => c.CommunityID == id).Select(c => c.WebAddress);
           var webInfosVM = webInfos.ConvertToWebInfoesVM();
 
           return Json(webInfosVM.ToDataSourceResult(request),JsonRequestBehavior.AllowGet);
       }
 
       [HttpPost]
       public ActionResult EditingInlineWebInfo_Create([DataSourceRequest] DataSourceRequest request, WebInfoVM webVM)
       {
           if (webVM != null && ModelState.IsValid)
           {
               var webAddr = webVM.ConvertToWebAddress();
               _service.Add<WebAddress>(webAddr);
               var task = _service.SaveChangesAsync();
               int result = task.Result;
           }
 
           return Json(new[] { webVM }.ToDataSourceResult(request, ModelState));
       }
 
       [HttpPost]
       public ActionResult EditingInlineWebInfo_Update([DataSourceRequest] DataSourceRequest request, WebInfoVM webVM)
       {
           if (webVM != null && ModelState.IsValid)
           {
               var webAddr = webVM.ConvertToWebAddress();
              var task = _service.SaveChangesAsync();
              int result = task.Result;
           }
 
           return Json(new[] { webVM }.ToDataSourceResult(request, ModelState));
 
       }

Vladimir Iliev
Telerik team
 answered on 21 Dec 2013
1 answer
73 views
I am starting a new scheduler on an existing database.
Making the scheduler showing the data from the database is working now, but only for the data i get via GetAll()
What i would like to do is take the date(range) from the scheduler and use that to get the data from the database
And ofcourse this should be done when the scheduler is started and everytime the view is changed (day, week, month) or the user navigate forward or backward.
Can someone point me in the right direction ?
Vladimir Iliev
Telerik team
 answered on 21 Dec 2013
5 answers
760 views
I have an older copy of the .net kendo ui sample code.  In the sample, the following ViewModel is included.

    public class ProductViewModel
    {
        public ProductDTO ProductMeta { get; set; }
        public int ProductID { get; set; }
        public string ProductName { get; set; }
        public decimal UnitPrice { get; set; }
        public int UnitsInStock { get; set; }
        public bool Discontinued { get; set; }
        public DateTime LastSupply { get; set; }
        public int UnitsOnOrder { get; set; }
    }

The VM also uses this class.

    public class ProductDTO
    {
        public int ProductID { get; set; }
        public string ProductName { get; set; }
        public decimal? UnitPrice { get; set; }
    }

In the Areas/razor/views/grid/editing.cshtml file, if I change the following line

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.ProductName);
      columns.Bound(p => p.UnitPrice).Width(140);        

TO....

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.ProductName);
      columns.Bound(p => p.ProductMeta.UnitPrice).Width(140);


The binding works correctly on update.  So if I change the value of unit price to 25, the vm.ProductMeta.UnitPrice value will be set appropriately to 25.

However, if I add the following statement (statement bolded), the binding no longer works

    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("error_handler"))
        .Model(model =>
            {
                model.Id(p => p.ProductID);
              model.Field(p => p.ProductMeta.UnitPrice).DefaultValue(30);
            })

Inspecting the payload sent to the GridController.EditingUpdate() method, I notice that the value for ProductMeta.UnitPrice is not changed.

Is there a work around for this?  

It seems like the grid is not overly fond of working with nested objects exposed from VMs, especially when using the Model() method.

I'd rather not have to flatten my VM in order to get this to work.

Thanks!
Pauline
Top achievements
Rank 1
 answered on 20 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?