Telerik Forums
UI for ASP.NET MVC Forum
3 answers
845 views
Hello! :)

I've searched for all over the place (understatement) for a solution to my case to no avail until now. First, I'll explain my scenario:
- I have an OpenAccess Model exposed as a WCF Data Service (oData v3);
- I have an Kendo MVC Application;
- I have a View with a grid, set for PopUp editing, AJAX Bound;
Before posting some code, let me explain my issue/difficulty. I have an entity with these properties:
 - TextoID
 - Titulo;
 - Corpo;
 - TipoTextoID;
 - TipoTexto;

There is a ForeignKey column set to the TipoTextoID property which get's correctly populated either in in-line or pop-up mode. But when it comes to changing data, it only works in-line mode. This is my issue I need it to work in a popup, since the "Corpo" property is bound to a KendoUI Editor.
When in the popup, it does not show the correct value on the dropdown. It shows always the first item on the dropdown.
Honestly I'm feeling stupid. I tried almost every sample, post, article I could find to no avail and I'm clueless.
I hope someone can help me on this. Thanks in advance to all!

So, here's the code.
The view:
01.@model IEnumerable<KendoMVC.CostSimulatorService.Texto>
02. 
03.@{
04.    ViewBag.Title = "Textos";
05.    Layout = "~/Views/Shared/_Layout.cshtml";
06.}
07. 
08.<h2>Textos</h2>
09. 
10.@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view
11.      .Name("Grid")
12.      .Columns(columns =>
13.      {
14.          columns.Bound(p => p.Titulo);   //Create a column bound to the "ProductID" property
15.          columns.Bound(p => p.IsPrivado)
16.              .ClientTemplate("<input type='checkbox' #= IsPrivado ? checked='checked': '' # class='chkbx' />")
17.              .Width(170); //Create a column bound to the "ProductName" property
18.          columns.ForeignKey(p => p.TipoTextoID,
19.                                 (System.Collections.IEnumerable)ViewData["TiposTexto"],
20.                                 "TipoTextoID",
21.                                 "Designacao")
22.                            .Title("Tipo de conteúdo").Width(170);
23.          columns.Command(command =>
24.          {
25.              command.Edit();
26.              command.Destroy().Text("Remover");
27.          }).Width(200).Title("Acções");
28.      })
29.      .ToolBar(commands => commands.Create())
30.          .Editable(editable => editable.Mode(GridEditMode.PopUp)
31.              .TemplateName("Texto")
32.              .Window(builder => builder
33.                  .Width(800)
34.                  .Height(570)
35.                  .Modal(true)
36.                  .Resizable(c => c.Enabled(true))
37.                  .Animation(true)
38.                  .Title("Editar conteúdo")))
39.      .DataSource(dataSource => dataSource
40.            .Ajax() //specify server type
41.            .PageSize(20)
42.            .Events(events => events.Error("error_handler"))
43.            .Model(model =>
44.            {
45.                model.Id(texto => texto.TextoID); // Specify the property which is the unique identifier of the model
46.                model.Field(texto => texto.TextoID).Editable(false); // Make the ProductID property not editable
47.            })
48.            .Create(create => create.Action("CreateTexto", "Textos"))
49.            .Read(read => read.Action("ReadTextos", "Textos"))
50.            .Update(update => update.Action("UpdateTexto", "Textos"))
51.            .Destroy(destroy => destroy.Action("DestroyTexto", "Textos")))
52.     .Pageable() // Enable paging
53.     .Sortable() // Enable sorting
54.     .Selectable()
55.     .Filterable()
56.     .Scrollable()
57.         )
58. 
59.<script type="text/javascript">
60. 
61.    $(document).ready(function() {       
62.        $("form.k-edit-form").kendoValidator();
63.    });
64. 
65.    function error_handler(e) {
66.        if (e.errors) {
67.            var message = "Errors:\n";
68.            $.each(e.errors, function (key, value) {
69.                if ('errors' in value) {
70.                    $.each(value.errors, function () {
71.                        message += this + "\n";
72.                    });
73.                }
74.            });
75.            alert(message);
76.        }
77.    }
78.</script>
Next, then template:
01.@using System.Web.Mvc.Html;
02. 
03.@model KendoMVC.CostSimulatorService.Texto
04. 
05.@Html.HiddenFor(model => model.TextoID)
06.<div id="divWrapper" style="width:99%; float:left; height:520px; margin-left:2px;">
07.    <div>
08.        @Html.LabelFor(model => model.Titulo)
09.    </div>
10.    <div>
11.        @Html.TextBoxFor(model => model.Titulo, new { @class="k-textbox" , style = "width: 480px;" })
12.        @Html.ValidationMessageFor(model => model.Titulo)
13.    </div>
14.    <div>
15.        @Html.LabelFor(model => model.Corpo)
16.    </div>
17.    <div style="width:98%;">
18.        @(Html.Kendo().EditorFor(model => model.Corpo)
19.                      .HtmlAttributes(new { style = "width: 740px;height:350px" })
20.                      .ImageBrowser(imageBrowser => imageBrowser
21.                                                                  .Image("~/Content/Uploads/Images/{0}")
22.                                                                  .Read("Read", "Textos")
23.                                                                  .Create("Create", "Textos")
24.                                                                  .Destroy("Destroy", "Textos")
25.                                                                  .Upload("Upload", "Textos")
26.                                                                  .Thumbnail("Thumbnail", "Textos"))
27.                        .Messages(m => m.DialogCancel("Cancelar")
28.                        .DialogInsert("Inserir")
29.                        .ImageAltText("Texto alternativo"))
30.                                                        )
31.        @Html.ValidationMessageFor(model => model.Corpo)
32.    </div>
33.    <div>
34.        @Html.LabelFor(model => model.TipoTextoID)
35.    </div>
36.    <div>
37.        @Html.HiddenFor(model => model.TipoTextoID)
38.        @(Html.Kendo().DropDownListFor(model => model.TipoTextoID)
39.            .Name("TiposTexto")
40.            .DataTextField("Designacao")
41.            .DataValueField("TipoTextoID")
42.            .BindTo((System.Collections.IEnumerable)
43.           ViewData["TiposTexto"]))
44.    </div>
45.    <div style="float:left; width:155px;">
46.        @Html.LabelFor(model => model.IsPrivado)
47.    </div>
48.    <div style="float:left;">
49.        @Html.CheckBoxFor(model => model.IsPrivado)
50.        @Html.ValidationMessageFor(model => model.IsPrivado)
51.    </div>
52.</div>
The controller:
001.using System;
002.using System.Data.Common.CommandTrees.ExpressionBuilder;
003.using System.IO;
004.using System.Linq;
005.using System.Web;
006.using System.Web.Mvc;
007.using Kendo.Mvc.Extensions;
008.using Kendo.Mvc.UI;
009.using KendoMVC.CostSimulatorService;
010.using KendoMVC.ImageBrowser.Models;
011. 
012.namespace KendoMVC.Controllers
013.{
014.    public partial class TextosController : EditorImageBrowserController
015.    {
016.        #region Propriedades e Campos
017. 
018.        private const string ContentFolderRoot = "~/Content/";
019.        private const string PrettyName = "Images/";
020.        private static readonly string[] foldersToCopy = new[] { "~/Content/Uploads/Shared/" };
021. 
022.        #endregion
023. 
024.        #region CRUD
025. 
026.        #region ReadTextos
027. 
028.        public ActionResult ReadTextos([DataSourceRequest]DataSourceRequest request)
029.        {
030.            CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/"));
031. 
032.            IQueryable<Texto> textos = modelo.Textos;
033.            DataSourceResult resultado = textos.ToDataSourceResult(request);
034.            ViewData["Textos"] = textos;
035.            return Json(resultado, JsonRequestBehavior.AllowGet);
036.        }
037. 
038.        #endregion
039. 
040.        #region CreateTexto
041. 
042.        [ValidateInput(false)]
043.        public ActionResult CreateTexto([DataSourceRequest]DataSourceRequest request, Texto texto)
044.        {
045.            if (ModelState.IsValid)
046.            {
047.                CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/"));
048.                 
049.                // Create a new Product entity and set its properties from the posted ProductViewModel
050.                Texto entity = new Texto
051.                {
052.                    TextoID = texto.TextoID,
053.                    Titulo = texto.Titulo,
054.                    Corpo = texto.Corpo,
055.                    IsPrivado = texto.IsPrivado,
056.                    TipoTextoID = texto.TiposTexto != null ? texto.TiposTexto.TipoTextoID : texto.TipoTextoID,
057.                    TiposTexto = texto.TiposTexto
058.                };
059.                modelo.AddToTextos(entity);
060.                // Insert the entity in the database
061.                modelo.SaveChanges();
062.                // Get the ProductID generated by the database
063.                texto.TextoID = entity.TextoID;
064.                return Json(new[] { entity }.ToDataSourceResult(request, ModelState));
065.            }
066.            // Return the inserted product. The grid needs the generated ProductID. Also return any validation errors.
067.            return Json(new[] { texto }.ToDataSourceResult(request, ModelState));
068.        }
069. 
070.        #endregion
071. 
072.        #region UpdateTexto
073. 
074.        [ValidateInput(false)]
075.        public ActionResult UpdateTexto([DataSourceRequest]DataSourceRequest request, Texto texto)
076.        {
077.            if (ModelState.IsValid)
078.            {
079.                CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/"));
080. 
081.                // Create a new Product entity and set its properties from the posted ProductViewModel
082.                var entity = new Texto
083.                {
084.                    TextoID = texto.TextoID,
085.                    Titulo = texto.Titulo,
086.                    Corpo = texto.Corpo,
087.                    IsPrivado = texto.IsPrivado,
088.                    TipoTextoID = texto.TiposTexto != null ? texto.TiposTexto.TipoTextoID : texto.TipoTextoID,
089.                    TiposTexto = texto.TiposTexto
090.                };
091.                // Attach the entity
092.                modelo.AttachTo("Textos", entity);
093.                modelo.UpdateObject(entity);
094.                // Update the entity in the database
095.                modelo.SaveChanges();
096.                return Json(new[] { entity }.ToDataSourceResult(request, ModelState));
097.            }
098.            // Return the updated product. Also return any validation errors.
099.            return Json(new[] { texto }.ToDataSourceResult(request, ModelState));
100.        }
101. 
102.        #endregion
103. 
104.        #region DestroyTexto
105.         
106.        public ActionResult DestroyTexto([DataSourceRequest]DataSourceRequest request, Texto texto)
107.        {
108.            if (ModelState.IsValid)
109.            {
110.                CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/"));
111. 
112.                // Create a new Product entity and set its properties from the posted ProductViewModel
113.                var entity = new Texto
114.                {
115.                    TextoID = texto.TextoID
116.                };
117.                // Attach the entity
118.                modelo.AttachTo("Textos", entity);
119.                // Delete the entity
120.                modelo.DeleteObject(entity);
121.                 
122.                // Delete the entity in the database
123.                modelo.SaveChanges();
124.                return Json(new[] { entity }.ToDataSourceResult(request, ModelState));
125.            }
126.            // Return the removed product. Also return any validation errors.
127.            return Json(new[] { texto }.ToDataSourceResult(request, ModelState));
128.        }
129. 
130.        #endregion
131. 
132.        #endregion
133. 
134.        #region ImageBrowser Code
135. 
136.        /// <summary>
137.        /// Gets the base paths from which content will be served.
138.        /// </summary>
139.        public override string ContentPath
140.        {
141.            get
142.            {
143.                return CreateUserFolder();
144.            }
145.        }
146. 
147.        private string CreateUserFolder()
148.        {
149.            var virtualPath = Path.Combine(ContentFolderRoot, "Uploads", PrettyName);
150. 
151.            var path = Server.MapPath(virtualPath);
152.            if (!Directory.Exists(path))
153.            {
154.                Directory.CreateDirectory(path);
155.                foreach (var sourceFolder in foldersToCopy)
156.                {
157.                    CopyFolder(Server.MapPath(sourceFolder), path);
158.                }
159.            }
160.            return virtualPath;
161.        }
162. 
163.        private void CopyFolder(string source, string destination)
164.        {
165.            if (!Directory.Exists(destination))
166.            {
167.                Directory.CreateDirectory(destination);
168.            }
169. 
170.            foreach (var file in Directory.EnumerateFiles(source))
171.            {
172.                var dest = Path.Combine(destination, Path.GetFileName(file));
173.                System.IO.File.Copy(file, dest);
174.            }
175. 
176.            foreach (var folder in Directory.EnumerateDirectories(source))
177.            {
178.                var dest = Path.Combine(destination, Path.GetFileName(folder));
179.                CopyFolder(folder, dest);
180.            }
181.        }
182. 
183.        #endregion
184.    }
185.}
This is a copy of my StackOverflow initial post (which got 0 replies in 3 days, so I had to come here :) )

Cheers and thanks in advance!
Manish
Top achievements
Rank 1
 answered on 30 Dec 2013
3 answers
216 views
Is it possible to move to edit button to the toolbar?

I have a grid of users and would the user logged in should only be allowed to edit their own info.

The solution I’m looking for is either:

1: only show edit button for the row containing them self

2. An edit button in the toolbar that opens the edit form with their info.

 My code so far:

@(Html.Kendo().TabStrip()

    .Name("Afdelinger")

    .Items(tabstrip =>

   
{

        tabstrip.Add()

            .Text("Odense")

            .Selected(true)

            .Content(

                @<text>

                    @RenderEmployeeGrid("Odense")

                </text>

            );

        tabstrip.Add()

            .Text("Købbenhavn")

            .Content(

                @<text>

                    @RenderEmployeeGrid("København")

                </text>

            );

    })

)

 

@helper RenderEmployeeGrid(string office)

{

   
@(

   
Html.Kendo().Grid<ADUser>()

        .Name("ActiveDirectoryUsers" + office)

        .Columns(columns =>

        {

            columns.Bound(p =>
p.ThumbnailPhoto64).Width(96).ClientTemplate("<img width='96'
height='96' src='data:image/png;base64,#=ThumbnailPhoto64#' />");

            columns.Bound(m =>
m.DisplayName).Width(300);

            columns.Bound(m =>
m.Mail).Width(125).ClientTemplate("<a href='mailto:#= Mail #'>#= Mail
#</a>");

            columns.Bound(m =>
m.TelephoneNumber).Width(125).ClientTemplate("<a href='tel:#=
TelephoneNumber #'>#= TelephoneNumber #</a>");

            columns.Bound(m =>
m.Mobile).Width(125).ClientTemplate("<a href='tel:#= Mobile #'>#= Mobile
#</a>");

  
         columns.Command(commands
=>

            {

                commands.Custom("Vis").Click("showDetails");

                commands.Edit();

            }).Title("Commands").Width(200);

        })

        .ToolBar(toolbar =>

          {

              toolbar.Custom().Text("Click
me").Action("ADUser_Update", "ADUser");

          })

        .Sortable()

        .Filterable()

        .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ADUser_Update"))

        .Pageable(pageable => pageable

            .Refresh(true)

            .PageSizes(true)

            .ButtonCount(10))

            .Events(events =>
events.DataBound("hideEditButton"))

        .DataSource(dataSource => dataSource

            .Ajax()

            .Read(read => read.Action("MembersByOffice_JSON", "ADUser", new { Office = office }))

            .Update(update => update.Action("ADUser_Update", "ADUser"))

            .PageSize(10)

            .Sort(sort => sort.Add(m =>
m.DisplayName))

            .Model(model => {

                model.Id(p =>
p.SAmAccountName);

                model.Field(field =>
field.ThumbnailPhoto).Editable(false);

 

            })

        )

    )

}
Michael
Top achievements
Rank 1
 answered on 27 Dec 2013
3 answers
115 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.6K+ 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
566 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
154 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
111 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
151 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
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
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?