Telerik Forums
UI for ASP.NET MVC Forum
3 answers
99 views
I'm playing with the Examples code particularly the Grid widget. I have modified the connectionstring to point to a remote SQL Server 2008 R2 database. It's reading the data remotely but when I try the Add or Edit on either of the Grid editing samples (Batch, Popup), it does not persists the update on the remote database. I noticed that it's using Session and it's only updating the Session data. Is this the behaviour of the Examples code?

I wanted to see an end to end code that updates the remote database.

Thanks.

allan
Alan
Top achievements
Rank 2
 answered on 27 Dec 2013
0 answers
1.2K+ views
When inserting a new record or updating the Kendo Grid I get this error.

My Controller
using System;
using System.Linq;
using System.Web.Mvc;
using KaringBasico.Models;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
using KaringHelper;

namespace KaringBasico.Controllers
{
    public class ActividadesEconomicasController : Controller
    {
        private readonly IUnitOfWork _uow;
        private readonly IRepository<actividades_economicas> selectedRepository;

        public ActividadesEconomicasController()
        {
            _uow = new UnitOfWork<BDKaringDataContext>();
            selectedRepository = _uow.GetRepository<actividades_economicas>();
        }

        public ActionResult Index()
        {
            ViewData["titulo_pagina"] = "Actividades Economicas";
            return View();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult _Create([DataSourceRequest] DataSourceRequest request, actividades_economicas tabla)
        {
            try
            {
                if (TryUpdateModel(tabla))
                {
                    selectedRepository.Add(tabla);
                    _uow.Save();
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
            }
            return Json(new[] { selectedRepository.GetAll() }.ToDataSourceResult(request, ModelState));
        }


        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult _Update([DataSourceRequest] DataSourceRequest request, string actividad_economica)
        {
            try
            {
                actividades_economicas tabla = selectedRepository.SearchFor(s => s.actividad_economica == actividad_economica).SingleOrDefault();
                if (tabla != null)
                {
                    if (TryUpdateModel(tabla))
                    {
                        _uow.Save();
                    }
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
            }
            return Json(new[] { selectedRepository.GetAll() }.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult _Destroy([DataSourceRequest] DataSourceRequest request, string actividad_economica)
        {
            try
            {
                actividades_economicas tabla = selectedRepository.SearchFor(s => s.actividad_economica == actividad_economica).SingleOrDefault();
                if (tabla != null)
                {
                    selectedRepository.Delete(tabla);
                    _uow.Save();
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
            }
            return Json(new[] { selectedRepository.GetAll() }.ToDataSourceResult(request, ModelState));
        }


        public ActionResult _Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(selectedRepository.GetAll().ToDataSourceResult(request));
        }
    }
}

My View

@model IEnumerable<KaringBasico.Models.actividades_economicas>

@{
    ViewBag.Title = "Actividades Economicas";
    Layout = "~/Views/Shared/_LayoutKendo.cshtml";
}

<h5><strong>@ViewBag.Title.</strong></h5>
@(Html.Kendo().Grid(Model)
    .Name("gridActividadesEconomicas")
    .Columns(columns =>
    {
        columns.Bound(p => p.actividad_economica).Width(160);
        columns.Bound(p => p.descripcion).Title("Descripción");
        
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(210);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .Resizable(resize => resize.Columns(true))
    .ColumnMenu()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(p => p.actividad_economica))

        .Create(update => update.Action("_Create", "ActividadesEconomicas"))
        .Read(read => read.Action("_Read", "ActividadesEconomicas"))
        .Update(update => update.Action("_Update", "ActividadesEconomicas"))
        .Destroy(update => update.Action("_Destroy", "ActividadesEconomicas"))
    )
)
<script type="text/javascript">
    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>


Uncaught SyntaxError: Unexpected number
 
at.setter                                                                                                                                                kendo.all.min.js:9
lt.extend._set                                                                                                                                            kendo.all.min.js:11
Vt.extend.accept                                                                                                                                          kendo.all.min.js:11
lt.extend._accept                                                                                                                                        kendo.all.min.js:11
(anonymous function)                                                                                                                                      kendo.all.min.js:11
(anonymous function)                                     jquery-1.10.2.js:3218
fire                                                     jquery-1.10.2.js:3062
self.fireWith                                                                                                                                            jquery-1.10.2.js:3174
deferred.(anonymous function)                            jquery-1.10.2.js:3263
o.(anonymous function).call.X.success                    kendo.all.min.js:11
fire                                                                                                                                                      jquery-1.10.2.js:3062
self.fireWith                                                                                                                                            jquery-1.10.2.js:3174
done                                                                                                                                                      jquery-1.10.2.js:8249
callback                                                                                                                                                  jquery-1.10.2.js:8792
Pablo Emilio
Top achievements
Rank 1
 asked on 27 Dec 2013
5 answers
1.5K+ 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
546 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
128 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
98 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
133 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
135 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
244 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
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
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?