Telerik Forums
Kendo UI for jQuery Forum
4 answers
194 views
I have a question concerning a specific problem that we are having. We have a grid set up that has a list of items that a user can add to, edit, and delete. 

When editing an item, the item needs to be removed from the grid until it goes through an approval process.

I know that if you press the delete button, an item is automatically removed from the grid. We want to emulate this when a person edits an item. 

Is this possible at all?  Any helpful tips would be appreciated. Thanks!
Nikolay Rusev
Telerik team
 answered on 05 Apr 2013
2 answers
1.3K+ views
Hi,
I have some problems to pass a list of items, for example a list of instances of a class, from a view to the controller. Please, can you help me?
I have a view with a kendo grid: the grid uses a read method which I want to pass a list of items. The read method is called correctly; also, it seems that from the view the list is well populated. The problem is that, when this list is read from the controller, it is a null object.
I tried to use the [Bind(Prefix = "...")] option, but I don't know how can I do it; it seems that it didn't work.
Then I tried to create a custom ModelBinder for the object i want to pass, but something's wrong.
More precisely, the object I need to pass to the controller is an instance of the ListaTipologieViewModel class, which contains a list of instances of the TipologiaViewModel class (I chose this way only because with this trick my code seems more clean than before).



THIS IS MY CODE

VIEW
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Sopra.Fmspa.BusinessLayer.ViewModels.ListaTipologieViewModel>"%>
 
    <%
        String idEdizione = Softailor.Net35.ExhibitorServices.BackOffice.ExhibitorServicesContextHandler.ac_EDIZIONE;
    %>
 
 
 
<%-- ******************************************************************************************************************** --%>
 
 
 
<% foreach (var element in Model.TipologieODL) { %>
 
    <p></p>
 
    <%= Html.Kendo().PanelBar()
    .Name("panelbarAllacciamenti")
    .ExpandMode(PanelBarExpandMode.Multiple)
    .HtmlAttributes(new { style = "width: 100%;" })
    .Items(panelbar =>
    {
        panelbar.Add().Text("Allacciamenti - ").HtmlAttributes(new { style = "font-weight:bold;" });
        panelbar.Add().Text(element.Descrizione).HtmlAttributes(new { style = "font-weight:bold;" });
        panelbar.Add().Text(Html.Action("TotaleAllacciamenti","ODL", new { ManifestazioneId = idEdizione, ClasseErogazioneId = "ALL", TipologiaId = element.Id }).ToString()).LoadContentFrom("Allacciamenti","ODL", new { ManifestazioneId = idEdizione, ClasseErogazioneId = "ALL", TipologiaId = element.Id }).Encoded(false);
    })
    %>
 
    <p></p>
 
    <%= Html.Kendo().PanelBar()
    .Name("panelbarservizi")
    .ExpandMode(PanelBarExpandMode.Multiple)
    .HtmlAttributes(new { style = "width: 100%;" })
    .Items(panelbar =>
    {
        panelbar.Add().Text("Servizi - ").HtmlAttributes(new { style = "font-weight:bold;" });
        panelbar.Add().Text(element.Descrizione).HtmlAttributes(new { style = "font-weight:bold;" });
        panelbar.Add().Text(Html.Action("TotaleServizi","ODL", new { ManifestazioneId = idEdizione, ClasseErogazioneId = "ACC", TipologiaId = element.Id }).ToString()).LoadContentFrom("Servizi","ODL", new { ManifestazioneId = idEdizione, ClasseErogazioneId = "ACC", TipologiaId = element.Id }).Encoded(false);
    })
    %>
 
<% } %>
 
    <p></p>
     <div style="border-bottom: 1px solid #999;"></div>
    <p></p>
 
 
 
<%-- ******************************************************************************************************************** --%>
 
 
 
    <div>
        <label for = "RagioneSociale" >Ragione Sociale</label>
        <%= Html.Kendo().AutoComplete()
          .Name("RagioneSocialeSearch")
          .Filter("startswith")
          .Placeholder("Inserire Ragione Sociale...") 
          .DataSource(source =>
            {
                    source.Read(read =>
                {
                    read.Action("GetRagioneSociale","Anagrafica", new { idEdizione = idEdizione });
                })
              .ServerFiltering(false); //If true the DataSource will not filter the data on the client
            })
          .HtmlAttributes(new { style = "width:250px" })
        %>
 
 
 
        <label for="AccountNumber">Account Number</label>
        <%= Html.Kendo().AutoComplete()
          .Name("AccountNumberSearch")
          .Placeholder("Inserire Account...")
          .DataSource(source =>
            {
                    source.Read(read =>
                {
                    read.Action("GetAccountNumber","Anagrafica", new { idEdizione = idEdizione });
                })
              .ServerFiltering(false); //If true the DataSource will not filter the data on the client
            })
          .HtmlAttributes(new { style = "width:150px" })
          %>
 
 
        <label for="Stand">Stand</label>
        <%= Html.Kendo().AutoComplete()
          .Name("StandSearch")
          .Placeholder("Inserire Stand...")
            .DataSource(source =>
            {
                    source.Read(read =>
                {
                    read.Action("GetStand","Anagrafica", new { idEdizione = idEdizione });
                })
              .ServerFiltering(false); //If true the DataSource will not filter the data on the client
            })
          .HtmlAttributes(new { style = "width:150px" })
          %>
     
        <div class = "right">
            <input type = "button" class = "k-button" name = "Search" id = "Search" aria-labelledby = "Search" value = "Search"/>
            <input type = "button" class = "k-button" name = "Clear" id = "Clear" value = "Clear"/>
        </div>
    </div>
 
    <p></p>
    <div style="border-bottom: 1px solid #999;"></div>
    <p></p>
 
    <p></p>
 
 
 
<%-- ******************************************************************************************************************** --%>
<%-- ******************************************************************************************************************** --%>
<%-- ******************************************************************************************************************** --%>
 
 
 
    <%: Html.Kendo().Grid<Sopra.Fmspa.BusinessLayer.ViewModels.Lista_ANAGRAFICAViewModel>()
            .Name("Espositori")
            .Columns(columns =>
                {
                    columns.Bound(a => a.ID).Hidden();
                    columns.Bound(a => a.ACCOUNTNUMBER)
                        .Filterable(filterable => filterable.UI("AccountFilter"))
                        .Title("Account");
                    columns.Bound(a => a.RAGIONESOCIALE)
                        .Filterable(filterable => filterable.UI("RagioneSocialeFilter"))
                        .Width(150)
                        .Title("Ragione Sociale");
                    columns.Bound(a => a.Tx_PADIGLIONE)
                        .Filterable(false)
                        .Width(120)
                        .Title("Padiglione");
                    columns.Bound(a => a.Ac_STAND)
                        .Filterable(false)
                        .Width(120)
                        .Title("Stand");
                    columns.Bound(a => a.FLAGSOLVENZA)
                        .Filterable(false)
                        .Title("Solvenza");
                    columns.Bound(a => a.COUNT_SERVIZI)
                        .Filterable(false)
                        .Title("Servizi");
                    columns.Bound(a => a.COUNT_ALLACCIAMENTI)
                        .Filterable(false)
                        .Title("Allacciamenti");
                })
                .ClientDetailTemplateId("EspositoriTemplate")
                .Pageable()
                .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("HierarchyBinding_Espositori","ODL", new { idEdizione = idEdizione, ElencoTipologie = Model }))
                .PageSize(5)
            )
            .Sortable()
            .Filterable()
            .Sortable()
            .Events(events => events.DataBound("dataBound"))
    %>
 
 
<%-- ******************************************************************************************************************** --%>
 
 
<script id="EspositoriTemplate" type="text/kendo-tmpl">
        <%: Html.Kendo().Grid<Sopra.Fmspa.BusinessLayer.ViewModels.Lista_ODLViewModel>()
            .Name("ODL_#=ID#")
            .Columns(columns =>
            {
                columns.Bound(o => o.Id)
                    .Filterable(false)
                    .Width(101)
                    .Title("N. ODL");
                columns.Bound(o => o.Desc_Priorita)
                    .Filterable(false)
                    .Width(140)
                    .Title("Priorità");
                columns.Bound(o => o.StatoId).Hidden();
                columns.Bound(o => o.Desc_Stato)
                    .Filterable(filterable => filterable.UI("ODLStatusFilter"))
                    .Width(200)
                    .Title("Stato");
                columns.Bound(o => o.Owner)
                    .Filterable(false)
                    .Width(200)
                    .Title("Owner");
                columns.Bound(o => o.Ufficio)
                    .Filterable(false)
                    .Width(200)
                    .Title("Ufficio");
                columns.Bound(o => o.Desc_Tipologia_ODL).Width(200).Title("Tipologia");
                columns.Bound(o => o.Desc_Classe_Erog).Width(200).Title("Classe Erog.");
                columns.Command(command => command.Custom("Apri").Click("ApriDettaglio")).Title("Dettaglio");
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model => model.Id(o => o.AnagraficaId))
                .Read(read => read.Action("HierarchyBinding_Orders","ODL", new { Id = "#=ID#", ElencoTipologie = Model, stato = "#=StatusFilter#", classe = "#=ClasseErogazioneFilter#", tipologia = "#=TipologiaFilter#" }))
            )
            .Sortable()
            .Filterable()
            .ToClientTemplate()
        %>
</script>
 
 
 
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
 
 
    function ApriDettaglio(e) {
        e.preventDefault();
        var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
        window.location.href = "<%:Url.Action("dettaglioOdl","ODL")%>" + "?odlid=" + dataItem.Id;
    }
</script>
 
 
 
<%-- ******************************************************************************************************************** --%>
<%-- ******************************************************************************************************************** --%>
 
 
 
<script>
    $("#Search").click(function () {
        $filter = new Array();
        $RagioneSociale = $("#RagioneSocialeSearch").val();
        $AccountNumber = $("#AccountNumberSearch").val();
        $Stand = $("#StandSearch").val();
 
 
        if ($RagioneSociale && $RagioneSociale != "Inserire Ragione Sociale...") {
            $filter.push({ field: "RagioneSociale", operator: "contains", value: $RagioneSociale });
        }
 
        if ($AccountNumber && $AccountNumber != "Inserire Account...") {
            $filter.push({ field: "AccountNumber", operator: "eq", value: $AccountNumber });
        }
 
        if ($Stand && $Stand != "Inserire Stand...") {
            $filter.push({ field: "Ac_STAND", operator: "contains", value: $Stand });
        }
 
 
        var Grid = $("#Espositori").data("kendoGrid");
        Grid.dataSource.filter({
            logic: "and",
            filters: $filter
        });
    })
 
 
    $("#Clear").click(function () {
        $("#RagioneSocialeSearch").val("");
        $("#AccountNumberSearch").val("");
        $("#StandSearch").val("");
 
        var Grid = $("#Espositori").data("kendoGrid");
        Grid.dataSource.filter({});
    })
</script>
 
 
<%-- ******************************************************************************************************************** --%>
 
 
<script>
    function RagioneSocialeFilter(element) {
        element.kendoDropDownList({
            dataSource: {
                transport: {
                    read: "<%= Url.Action("Anagrafiche_RagioneSocialeFilter") %>"
                    }
                },
                optionLabel: "--Scegliere ragione sociale--"
            });
        }
 
        function AccountFilter(element) {
            element.kendoDropDownList({
                dataSource: {
                    transport: {
                        read: "<%= Url.Action("Anagrafiche_AccountNumberFilter") %>"
                    }
                },
                optionLabel: "--Scegliere account number--"
            });
        }
 
        function ODLStatusFilter(element) {
            element.kendoDropDownList({
                dataSource: {
                    transport: {
                        read: "<%= Url.Action("ODL_ODLStatusFilter")%>"
                    }
                },
                optionLabel: "--Specificare stato ODL--"
            });
        }
</script>
CONTROLLER - see the GestioneODL region
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.IO;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Sopra.Fmspa.BusinessLayer.Models;
using Sopra.Fmspa.BusinessLayer.DAL;
using Sopra.Fmspa.BusinessLayer.ViewModels;
using System.Data.Entity.Validation;
using System.Diagnostics;
using Softailor.Net35.BusinessLayer;
 
 
namespace Sopra.Fmspa.WebServiceLayer.Controllers
{
 
    public class ODLController : Controller
    {
        ODLModelContainer db = new ODLModelContainer();
        FileEntities dbAllegati = new FileEntities();
        private IAnagraficaRepository anagraficaRepository;
        private IODLRepository odlRepository;
 
        #region Costructors
 
        public ODLController()
        {
            this.odlRepository = new ODLRepository();
            this.anagraficaRepository = new AnagraficaRepository(new AnagraficaInBiancoModelContainer());
        }
 
 
        public ODLController(IODLRepository odlRepository)
        {
            this.odlRepository = odlRepository;
        }
 
        public ODLController(IAnagraficaRepository anagraficaRepository)
        {
            this.anagraficaRepository = anagraficaRepository;
        }
 
        #endregion Constructors
 
        #region Dispose
 
        protected override void Dispose(bool disposing)
        {
            anagraficaRepository.Dispose();
            odlRepository.Dispose();
            base.Dispose(disposing);
        }
 
        #endregion
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
        #region Views
 
        public ActionResult CreaODL(ODLViewModel odlview)
        {
            if ((odlview == null) || (odlview.Id == 0))
            {
                odlview = new ODLViewModel();
            }
 
            if (odlview.Id != 0)
            {
                odlview.Anagrafica = anagraficaRepository.GetAnagraficaById(odlview.AnagraficaId);
            }
 
            odlview.StatoId = "00";
            return View(odlview);
        }
 
 
        public ActionResult ODLPartialView()
        {
            ODLViewModel EmptyView = new ODLViewModel();
            EmptyView.StatoId = "00";
            return PartialView(EmptyView);
        }
 
 
        public ActionResult ClasseErogazioneView(ODLViewModel odlview, int anagrafica, string tipologia, string priorita)
        {
            if (odlview == null)
            {
                odlview = new ODLViewModel();
            }
            odlview.AnagraficaId = anagrafica;
            odlview.TipologiaId = tipologia;
            odlview.StatoId = "00";
            odlview.PrioritaId = priorita;
 
            return PartialView(odlview);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult GestioneODL(List<string> tipologie)
        {
            ListaTipologieViewModel model = new ListaTipologieViewModel();
            List<TipologiaViewModel> ListaTipologie = odlRepository.GetTipologiaList().ToList();
 
            foreach (var tipologia in tipologie)
            {
                model.TipologieODL.Add(ListaTipologie.Where(x => x.Id == tipologia).FirstOrDefault());
            }
 
            return PartialView(model);
        }
 
 
        public ActionResult GestioneElettrico()
        {
            return View();
        }
 
        public ActionResult GestioneIdroAria()
        {
            return View();
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult CreaGruppi()
        {
            return View();
        }
 
        public ActionResult MonitoraggioManutentori()
        {
            return View();
        }
 
        public ActionResult Solvenze()
        {
            return View();
        }
 
        #endregion Views
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
        #region ODL
 
        //public ActionResult ODL_Read([DataSourceRequest] DataSourceRequest request)
        //{
        //    return Json(odlRepository.GetODLList().ToDataSourceResult(request));
        //}
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
        public ActionResult DettaglioODL(int ODLid, String idEdizione)
        {
            //int _id = int.Parse(ODLid);
            ODLModelContainer cx = new ODLModelContainer();
            ODLViewModel _odl = odlRepository.GetODLById(ODLid);
            //_odl.Anagrafica = anagraficaRepository.GetAnagraficaById(_odl.AnagraficaId);
            return View(_odl);
        }
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult ODL_Create([DataSourceRequest] DataSourceRequest request, ODLViewModel odl)
        {
            if (odl != null && ModelState.IsValid)
            {
                odl.Anagrafica = null;
                odl.StatoId = "00";
                odl.DataCreazione = DateTime.Today;
                odl.DataModifica = DateTime.Today;
                odl.DataInizioIntervento = DateTime.Today;
 
                odl = odlRepository.Insert(odl);
                odlRepository.Save();
            }
 
            return RedirectToAction("CreaODL",odl);
            //return Json(new[] { odl }.ToDataSourceResult(request,ModelState));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult UpdateTestata(int id, ElettricaViewModel Elettrica, int Gruppo, string Priorita, Nullable<DateTime> DataInizioIntervento)
        {
            ODLViewModel odl = odlRepository.GetODLById(id);
            if (ModelState.IsValid)
            {
                if (odl.Elettrica != null)
                {
                    odl.Elettrica.FlagVisuraCamerale = Elettrica.FlagVisuraCamerale;
                    odl.Elettrica.FlagConformita = Elettrica.FlagConformita;
                }
 
                odl.GruppoId = Gruppo;
                odl.PrioritaId = Priorita;
 
                odlRepository.Update(odl);
                odlRepository.Save();
            }
            return PartialView("Testata", odl);
        }
 
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
        #endregion ODL
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
        #region FieldLists
 
        public ActionResult GetTipologiaODLList()
        {
            return Json(odlRepository.GetTipologiaList().Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetClasseErogazioneODLList()
        {
            return Json(odlRepository.GetClasseErogazioneList().Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetClasseErogazioneODLFilteredList(string tipologia)
        {
            return Json(odlRepository.GetClasseErogazioneFilteredList(tipologia).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetPrioritaODLList()
        {
            return Json(odlRepository.GetPrioritaList().Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetStatoODLList()
        {
            return Json(odlRepository.GetStatoList().Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetGruppiList(String idEdizione)
        {
            return Json(odlRepository.GetGruppiList(idEdizione).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult GetTipologiaODL()
        {
            return Json(odlRepository.GetTipologiaList(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetClasseErogazioneODL()
        {
            return Json(odlRepository.GetClasseErogazioneList(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetClasseErogazioneODLFiltrata(string tipologia)
        {
            return Json(odlRepository.GetClasseErogazioneFilteredList(tipologia), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetPrioritaODL()
        {
            return Json(odlRepository.GetPrioritaList(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetStatoODL()
        {
            return Json(odlRepository.GetStatoList(), JsonRequestBehavior.AllowGet);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        //public ActionResult GetPresaODL()
        //{
        //    return Json(odlRepository.GetODLList().Select(x => x.PresaODL.ToList()).Distinct(), JsonRequestBehavior.AllowGet);
        //}
 
        //public ActionResult GetArticoloODL()
        //{
        //    return Json(odlRepository.GetODLList().Select(x => x.ArticoloODL.ToList()).Distinct(), JsonRequestBehavior.AllowGet);
        //}
 
        //public ActionResult GetStoricoODL()
        //{
        //    return Json(odlRepository.GetODLList().Select(x => x.Storico.ToList()).Distinct(), JsonRequestBehavior.AllowGet);
        //}
 
        //public ActionResult GetNotaODL()
        //{
        //    return Json(odlRepository.GetODLList().Select(x => x.Nota.ToList()).Distinct(), JsonRequestBehavior.AllowGet);
        //}
 
        //public ActionResult GetAllegatoODL()
        //{
        //    return Json(odlRepository.GetODLList().Select(x => x.Allegato.ToList()).Distinct(), JsonRequestBehavior.AllowGet);
        //}
 
        #endregion FieldLists
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
 
        #region-Prese
         
        public ActionResult Prese(string ODLid)
        {
            PopulatePrese();
 
            int _id = int.Parse(ODLid);
            ODLViewModel _odl = odlRepository.GetODLById(_id);
             
            return PartialView(_odl);
        }
 
        private void PopulatePrese()
        {
            ViewData["Prese"] = odlRepository.PopulatePreseCall();
        }
 
        public ActionResult Editing_Read_Prese(string ODLid, [DataSourceRequest] DataSourceRequest request)
        {
            PopulatePrese();
 
            return Json(odlRepository.GetPresaList(ODLid).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_Create_Prese([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<PresaODLViewModel> presa)
        {
            try
            {
 
                var results = new List<PresaODLViewModel>();
 
                if (presa != null && ModelState.IsValid)
                {
                    foreach (var pre in presa)
                    {
                        pre.PresaId = pre.Presa.Id;
                        pre.Presa = null;
 
                        odlRepository.InsertPresa(pre);
                    }
 
                    odlRepository.Save();
                }
 
                return Json(results.ToDataSourceResult(request, ModelState));
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
 
                return null;
 
            }
 
        }
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_Update_Prese([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<PresaODLViewModel> prese)
        {
            if (prese != null && ModelState.IsValid)
            {
                foreach (var pre in prese)
                {
                    pre.Id = pre.Id;
                    pre.QDS = pre.QDS;
                    pre.Presa = pre.Presa;
                    pre.Presa1 = pre.Presa1;
                    pre.Presa2 = pre.Presa2;
                    pre.Presa3 = pre.Presa3;
                    pre.Presa4 = pre.Presa4;
                    pre.Presa5 = pre.Presa5;
 
                    odlRepository.UpdatePresa(pre);
                }
                odlRepository.Save();
            }
            return Json(ModelState.ToDataSourceResult());
        }
 
        public ActionResult Editing_Destroy_Prese([Bind(Prefix = "models")]IEnumerable<PresaODLViewModel> presa)
        {
            if (ModelState.IsValid)
            {
                foreach (var pre in presa)
                {
                    odlRepository.DeletePresa(pre);
                }
            }
            odlRepository.Save();
 
            return Json(ModelState.ToDataSourceResult());
        }
 
        #endregion-Prese
 
        #region-lista articoli
 
        public ActionResult ListaArticoli(int ODLid)
        {
            PopulateListaArticoli();
            ODLViewModel _odl = odlRepository.GetODLById(ODLid);
            return PartialView(_odl);
        }
 
        public ActionResult ListaArticoliPartialView(int ODLid)
        {
            ODLViewModel ODLArticoliView = odlRepository.GetODLById(ODLid);
 
            if ((ODLArticoliView == null) || (ODLArticoliView.Id == 0))
            {
                return RedirectToAction("CreaODL",ODLArticoliView);
            }
            return PartialView(ODLArticoliView);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Editing_ReadArticoliODL([DataSourceRequest] DataSourceRequest request, int ODLid)
        {
            return Json(odlRepository.GetODLArticoliList(ODLid).ToDataSourceResult(request));
        }
 
 
        public ActionResult Editing_ReadElencoArticoli([DataSourceRequest] DataSourceRequest request)
        {
            return Json(odlRepository.GetArticoliList().Distinct().ToDataSourceResult(request));
        }
 
        public ActionResult Editing_ReadElencoArticoliFiltrato([DataSourceRequest] DataSourceRequest request, int ODLid)
        {
            ODLViewModel odl = odlRepository.GetODLById(ODLid);
            return Json(odlRepository.GetArticoliList().Where(x => (x.Tipologia == odl.TipologiaId) && (x.ClasseErogazione == odl.ClasseErogazioneId)).ToList().Distinct().ToDataSourceResult(request));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        private void PopulateListaArticoli()
        {
            ViewData["ListaArticoli"] = odlRepository.GetArticoliList();
        }
 
 
        public ActionResult GetDescrizioneArticolo()
        {
            return Json(odlRepository.GetArticoliList().Select(x => x.Descrizione).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetTipologiaArticolo()
        {
            return Json(odlRepository.GetArticoliList().Select(x => x.Tipologia).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetClasseErogazioneArticolo()
        {
            return Json(odlRepository.GetArticoliList().Select(x => x.ClasseErogazione).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_CreateArticoli([DataSourceRequest] DataSourceRequest request, ArticoloODLViewModel articoloview, int ODLid)
        {
            if (articoloview != null && ModelState.IsValid)
            {
                articoloview.ODLId = ODLid;
                articoloview.Articolo.Id = articoloview.ArticoloId;
 
                ArticoloODL articolo = new ArticoloODL();
                IEnumerable<ArticoloODLViewModel> articoliODL = odlRepository.GetODLArticoliList(ODLid);
 
                foreach (var art in articoliODL)
                {
                    if (articoloview.ArticoloId == art.ArticoloId)
                    {
                        odlRepository.UpdateArticoloInserito(art.Id,art.QuantitaOrdinata,articoloview.QuantitaOrdinata);
                        return RedirectToAction("CreaODL",odlRepository.GetODLById(ODLid));
                    }
                }
 
                articoloview = odlRepository.InsertArticolo(articoloview);
                odlRepository.Save();
            }
            return Json(new[] { articoloview }.ToDataSourceResult(request,ModelState));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_UpdateArticoli([DataSourceRequest] DataSourceRequest request, ArticoloODLViewModel articoloview, int ODLid)
        {
            if (articoloview != null && ModelState.IsValid)
            {
                articoloview.ODLId = ODLid;
                articoloview.Articolo.Id = articoloview.ArticoloId;
                odlRepository.UpdateArticolo(articoloview);
            }
            return Json(ModelState.ToDataSourceResult());
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Editing_DeleteArticoli(ArticoloODLViewModel articoloview)
        {
            odlRepository.DeleteArticolo(articoloview);
            return Json(ModelState.ToDataSourceResult());
        }
 
        #endregion-lista articoli
 
 
        #region-storico
 
        public ActionResult Storico()
        {
            return PartialView();
        }
 
        public ActionResult Editing_ReadStorico([DataSourceRequest] DataSourceRequest request, int ODLid)
        {
            return Json(odlRepository.GetStoricoList(ODLid).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
 
        #endregion-Storico
 
        #region-Nota
 
        public ActionResult Note(string ODLid)
        {
            int _id = int.Parse(ODLid);
            ODLViewModel _odl = odlRepository.GetODLById(_id);
 
            return PartialView(_odl);
        }
 
 
        public ActionResult Editing_ReadNote([DataSourceRequest] DataSourceRequest request, string ODLid)
        {
            return Json(odlRepository.GetNotaList(ODLid).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_CreateNote([DataSourceRequest] DataSourceRequest request, NotaViewModel nota)
        {
            if (nota != null )//&& ModelState.IsValid)
            {
                nota.DataCreazione = DateTime.Now;
                odlRepository.InsertNota(nota);
            }
 
            return RedirectToAction("Note", nota);
        }
 
        #endregion-nota
 
        #region-allegati
 
        public ActionResult Allegati(int ODLid)
        {
            ODLViewModel ODLAllegatiView = odlRepository.GetODLById(ODLid);
 
            if ((ODLAllegatiView == null) || (ODLAllegatiView.Id == 0))
            {
                return RedirectToAction("CreaODL",ODLAllegatiView);
            }
            return PartialView(ODLAllegatiView);
        }
 
 
        public ActionResult Editing_ReadAllegati([DataSourceRequest] DataSourceRequest request, int ODLid)
        {
            return Json(odlRepository.GetODLAllegatiList(ODLid).Distinct().ToDataSourceResult(request));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Save(IEnumerable<HttpPostedFileBase> files, int ODLid)
        {
            if (files != null && ModelState.IsValid)
            {
                foreach (var file in files)
                {
                    dob_FILESRICEVUTI FileAllegato = odlRepository.InsertFileAllegato(file,ODLid);
                    Lista_AllegatoViewModel allegatoview = AutoMapper.Mapper.Map<dob_FILESRICEVUTI,Lista_AllegatoViewModel>(FileAllegato);
                    allegatoview.ODLId = ODLid;
                    allegatoview = odlRepository.InsertAllegato(allegatoview);
                    odlRepository.Save();
                }
            }
            // Return an empty string to signify success
            return Content("");
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Remove(string[] fileNames, int ODLid)
        {
            // The parameter of the Remove action must be called "fileNames"
            if (fileNames != null)
            {
                odlRepository.DeleteAllegato(fileNames,ODLid);
            }
            // Return an empty string to signify success
            return Content("");
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Visualizza(int IdAllegato)
        {
            dob_FILESRICEVUTI FileAllegato = odlRepository.GetAllegatoById(IdAllegato);
            var cd = new System.Net.Mime.ContentDisposition
            {
                FileName = FileAllegato.tx_NOMEFILE,
                // always prompt the user for downloading, set to true if you want
                // the browser to try to show the file inline
                Inline = true,
            };
            Response.AppendHeader("Content-Disposition",cd.ToString());
            return new FileStreamResult(new MemoryStream(FileAllegato.bd_FILE),FileAllegato.ac_ESTENSIONE);
        }
 
 
        public ActionResult Download(int IdAllegato)
        {
            dob_FILESRICEVUTI FileAllegato = odlRepository.GetAllegatoById(IdAllegato);
            var cd = new System.Net.Mime.ContentDisposition
            {
                FileName = FileAllegato.tx_NOMEFILE,
                // always prompt the user for downloading, set to true if you want
                // the browser to try to show the file inline
                Inline = false,
            };
            Response.AppendHeader("Content-Disposition",cd.ToString());
            return File(FileAllegato.bd_FILE,FileAllegato.ac_ESTENSIONE);
        }
 
        #endregion-allegati
 
 
        #region-gruppi
 
        public ActionResult Gruppi_Read([DataSourceRequest] DataSourceRequest request, String idEdizione)
        {
            IEnumerable<GruppoViewModel> gruppi = odlRepository.GetGruppiList(idEdizione);
            foreach (var gruppo in gruppi)
            {
                gruppo.NumeroODLAssociate = odlRepository.GetODLViewsByGroupId(gruppo.Id).Count();
                if (gruppo.controllo != 1)
                {
                    gruppo.controllo = 1;
                }
            }
 
            return Json(gruppi.ToDataSourceResult(request));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Gruppi_Create([DataSourceRequest] DataSourceRequest request, GruppoViewModel gruppoview, String idEdizione)
        {
            if ((gruppoview != null && ModelState.IsValid) && (gruppoview.controllo == null))
            {
                gruppoview.NumeroODLAssociate = 0;
                gruppoview.controllo = 0;
                gruppoview.ManifestazioneId = idEdizione;
                //gruppoview.DataCreazione = DateTime.Now;
                gruppoview = odlRepository.InsertGruppo(gruppoview);
                odlRepository.Save();
            }
            return Json(new[] { gruppoview }.ToDataSourceResult(request,ModelState));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Gruppi_Delete(GruppoViewModel gruppoview)
        {
            if (gruppoview != null && ModelState.IsValid)
            {
                odlRepository.DeleteGruppo(gruppoview);
            }
            return Json(ModelState.ToDataSourceResult());
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult HierarchyBinding_Groups(int Id, [DataSourceRequest] DataSourceRequest request)
        {
            IList<ODLViewModel> ODLs = odlRepository.GetODLViewsByGroupId(Id);
            foreach (var odl in ODLs)
            {
                odl.Anagrafica = anagraficaRepository.GetAnagraficaById(odl.AnagraficaId);
            }
            return Json(ODLs.ToDataSourceResult(request));
        }
 
        #endregion
 
        #region-manutentori
 
        public ActionResult Manutentori_Read([DataSourceRequest] DataSourceRequest request)
        {
            IEnumerable<TabletPadiglioniViewModel> manutentori = odlRepository.GetManutentoriPadiglioniList();
            Tablet SquadraManutentori = new Tablet();
            foreach (var squadra in manutentori)
            {
                SquadraManutentori = odlRepository.GetManutentoriById(squadra.Id);
                squadra.OnlineStatus = SquadraManutentori.OnlineStatus;
                squadra.DataUltimoAggiornamento = SquadraManutentori.DataUltimoAggiornamento;
 
                if (squadra.controllo == null)
                {
                    squadra.controllo = 1;
                }
            }
 
            if (request.Filters.ToList().Count > 0)
            {
                return Json(manutentori.ToDataSourceResult(request));
            }
            else
            {
                return ReorganizeResults(request,manutentori);
            }
        }
 
 
        public ActionResult ReorganizeResults([DataSourceRequest] DataSourceRequest request, IEnumerable<TabletPadiglioniViewModel> manutentori)
        {
            var SquadreManutentori = (from x in manutentori
                             group x by x.Id into y
                             select new
                             {
                                 Id = y.Key,
                                 OnlineStatus = y.Select(z => z.OnlineStatus).FirstOrDefault(),
                                 DataUltimoAggiornamento = y.Select(z => z.DataUltimoAggiornamento).FirstOrDefault(),
                                 ODLPreseInCarico = y.Sum(z => z.ODLPreseInCarico),
                                 ODLTerminate = y.Sum(z => z.ODLTerminate),
                                 ODLTerminateConModifiche = y.Sum(z => z.ODLTerminateConModifiche),
                                 ODLTerminateOggi = y.Sum(z => z.ODLTerminateOggi),
                                 ODLTerminateConModificheOggi = y.Sum(z => z.ODLTerminateConModificheOggi),
                                 ODLNonTerminate = y.Sum(z => z.ODLNonTerminate)
                             });
 
            return Json(SquadreManutentori.ToDataSourceResult(request));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult GetIdTablet()
        {
            return Json(odlRepository.GetManutentoriList().Select(x => x.Id).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult GetStatoTablet()
        {
            return Json(odlRepository.GetManutentoriList().Select(x => x.OnlineStatus).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult ODL_TabletFilter()
        {
            return Json(odlRepository.GetManutentoriList().Select(e => e.Id).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        public ActionResult ODL_StatoTabletFilter()
        {
            return Json(odlRepository.GetManutentoriList().Select(e => e.OnlineStatus).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult HierarchyBinding_Manutentori(int Id, string ManifestazioneId, [DataSourceRequest] DataSourceRequest request)
        {
            IList<ODLViewModel> ODLs = new List<ODLViewModel>();
            if ((ManifestazioneId != null) && (ManifestazioneId != "") && (ManifestazioneId != "undefined"))
            {
                ODLs = odlRepository.GetODLViewsByTabletId(Id).Where(x => x.Anagrafica.MANIFESTAZIONEID == ManifestazioneId).ToList();
            }
            else
            {
                ODLs = odlRepository.GetODLViewsByTabletId(Id);
            }
 
            foreach (var odl in ODLs)
            {
                odl.Anagrafica = anagraficaRepository.GetAnagraficaById(odl.AnagraficaId);
            }
            return Json(ODLs.ToDataSourceResult(request));
        }
 
        #endregion
 
        #region-solvenze
 
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Anagrafiche_SolvenzeUpdate([DataSourceRequest] DataSourceRequest request, Lista_ANAGRAFICAViewModel anagrafica)
        {
            if (anagrafica != null && ModelState.IsValid)
            {
                odlRepository.UpdateSolvenze(anagrafica);
            }
 
            return Json(ModelState.ToDataSourceResult());
        }
 
        #endregion
 
 
        #region-GestioneODL
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult Allacciamenti(String ManifestazioneId, string ClasseErogazioneId, string TipologiaId)
        {
            SituazioneODLViewModel situazioneODLview = odlRepository.GetSituazioneODL(ManifestazioneId,ClasseErogazioneId,TipologiaId);
            return PartialView(situazioneODLview);
        }
 
        public ActionResult TotaleAllacciamenti(String ManifestazioneId, string ClasseErogazioneId, string TipologiaId)
        {
            SituazioneODLViewModel situazioneODLview = odlRepository.GetSituazioneODL(ManifestazioneId,ClasseErogazioneId,TipologiaId);
            return PartialView(situazioneODLview);
        }
 
 
        public ActionResult Servizi(String ManifestazioneId, string ClasseErogazioneId, string TipologiaId)
        {
            SituazioneODLViewModel situazioneODLview = odlRepository.GetSituazioneODL(ManifestazioneId,ClasseErogazioneId,TipologiaId);
            return PartialView(situazioneODLview);
        }
 
        public ActionResult TotaleServizi(String ManifestazioneId, string ClasseErogazioneId, string TipologiaId)
        {
            SituazioneODLViewModel situazioneODLview = odlRepository.GetSituazioneODL(ManifestazioneId,ClasseErogazioneId,TipologiaId);
            return PartialView(situazioneODLview);
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult HierarchyBinding_Espositori([DataSourceRequest] DataSourceRequest request, String idEdizione, ListaTipologieViewModel ElencoTipologie)
        {
            IList<Lista_ANAGRAFICAViewModel> anagrafiche = anagraficaRepository.GetAnagraficaList(idEdizione).ToList();
            IList<Lista_ODLViewModel> ODLs = new List<Lista_ODLViewModel>();
            IList<Lista_ANAGRAFICAViewModel> AnagraficheFiltrate = new List<Lista_ANAGRAFICAViewModel>();
 
 
            bool ActivateFilter = false;
            if ((request.Filters.Count > 0) && (ActivateFilter == true))
            {
                foreach (var InputRequest in request.Filters.ToList())
                {
                    var FiltroComposito = (Kendo.Mvc.CompositeFilterDescriptor)InputRequest;
                    foreach (var filter in FiltroComposito.FilterDescriptors.ToList())
                    {
                        var filtro = (Kendo.Mvc.FilterDescriptor)filter;
                        foreach (var anag in anagrafiche)
                        {
                            if (filtro.Member.ToString() == "StatusFilter")
                            {
                                anag.StatusFilter = filtro.Value.ToString();
                            }
                            if (filtro.Member.ToString() == "ClasseErogazioneFilter")
                            {
                                anag.ClasseErogazioneFilter = filtro.Value.ToString();
                            }
                            anag.TipologiaFilter = "ELET";
                        }
                    }
                }
 
                foreach (var anag in anagrafiche)
                {
                    ODLs = odlRepository.GetODLViewsByAnagraficaId(anag.ID).Where(x => x.StatoId.Equals(anag.StatusFilter) && x.Id_Classe_Erog.TrimEnd().Equals(anag.ClasseErogazioneFilter) && x.Id_Tipologia_ODL.Equals(anag.TipologiaFilter)).ToList();
                    if (ODLs.Count == 0)
                    {
                        anag.Visualizzazione = false;
                    }
                }
            }
            else if (ElencoTipologie != null)
            {
                List<string> tipologie = new List<string>();
                foreach (var element in ElencoTipologie.TipologieODL)
                {
                    tipologie.Add(element.Id);
                }
 
                foreach (var anag in anagrafiche)
                {
                    ODLs = odlRepository.GetODLViewsByAnagraficaId(anag.ID).Where(x => tipologie.Contains(x.Id_Tipologia_ODL)).ToList();
                    if (ODLs.Count == 0)
                    {
                        anag.Visualizzazione = false;
                    }
                }
            }
            else
            {
                foreach (var anag in anagrafiche)
                {
                    ODLs = odlRepository.GetODLViewsByAnagraficaId(anag.ID).ToList();
                    if (ODLs.Count == 0)
                    {
                        anag.Visualizzazione = false;
                    }
                }
            }
 
 
            AnagraficheFiltrate = anagrafiche.Where(x => x.Visualizzazione == true).ToList();
            ActivateFilter = false;
            return Json(AnagraficheFiltrate.ToDataSourceResult(request));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult HierarchyBinding_Orders(int Id, ListaTipologieViewModel ElencoTipologie, string stato, string classe, string tipologia, [DataSourceRequest] DataSourceRequest request)
        {
            IList<Lista_ODLViewModel> ODLs = new List<Lista_ODLViewModel>();
 
            if (((stato == null) || (stato == "null")) && (ElencoTipologie != null))
            {
                List<string> tipologie = new List<string>();
                foreach (var element in ElencoTipologie.TipologieODL)
                {
                    tipologie.Add(element.Id);
                }
                ODLs = odlRepository.GetODLViewsByAnagraficaId(Id).Where(x => tipologie.Contains(x.Id_Tipologia_ODL)).ToList();
            }
            else if ((stato == null) || (stato == "null"))
            {
                ODLs = odlRepository.GetODLViewsByAnagraficaId(Id).ToList();
            }
            else
            {
                ODLs = odlRepository.GetODLViewsByAnagraficaId(Id).Where(x => x.StatoId.Equals(stato) && x.Id_Classe_Erog.TrimEnd().Equals(classe) && x.Id_Tipologia_ODL.Equals(tipologia)).ToList();
            }
 
            return Json(ODLs.ToDataSourceResult(request));
        }
 
 
//   ---------------------------------------------------------------------------------------------- //
 
 
        public ActionResult ODL_ODLStatusFilter()
        {
            return Json(odlRepository.GetODLList().Select(e => e.Desc_Stato).Distinct(), JsonRequestBehavior.AllowGet);
        }
 
        #endregion
    }
 
}
OBJECT TO PASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sopra.Fmspa.BusinessLayer.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
 
namespace Sopra.Fmspa.BusinessLayer.ViewModels
{
    public class ListaTipologieViewModel
    {
        public ListaTipologieViewModel()
        {
            this.TipologieODL = new HashSet<TipologiaViewModel>();
        }
 
        public ICollection<TipologiaViewModel> TipologieODL { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sopra.Fmspa.BusinessLayer.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Sopra.Fmspa.BusinessLayer.ViewModelsValidators;
 
namespace Sopra.Fmspa.BusinessLayer.ViewModels
{
    [FluentValidation.Attributes.Validator(typeof(TipologiaViewModelValidator))]
    public class TipologiaViewModel
    {
        //  //[Required(ErrorMessage = "Il campo Tipologia ODL è obbligatorio")]
        [Display(Name = "Id Tipologia ODL")]
        [DisplayFormat(NullDisplayText = "Id assente")]
        [ScaffoldColumn(false)]
        public string Id { get; set; }
 
        //  //[Required(ErrorMessage = "Il campo Descrizione è obbligatorio")]
        [Display(Name = "Descrizione")]
        [DisplayFormat(NullDisplayText = "")]
        public string Descrizione { get; set; }
    }
}
MODELBINDER CLASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.IO;
using System.Globalization;
using Sopra.Fmspa.BusinessLayer.Models;
using Sopra.Fmspa.BusinessLayer.DAL;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
 
 
namespace Sopra.Fmspa.BusinessLayer.ViewModels
{
    public class ListaTipologieModelBinder : IModelBinder
    {
        private IODLRepository odlRepository;
 
        public ListaTipologieModelBinder()
        {
            this.odlRepository = new ODLRepository();
        }
 
        public ListaTipologieModelBinder(IODLRepository odlRepository)
        {
            this.odlRepository = odlRepository;
        }
 
 
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var ElencoTipologie = (ListaTipologieViewModel)(bindingContext.Model ?? new ListaTipologieViewModel());
            int dim = odlRepository.CountTipologie();
            for (int k = 0; k < dim ; k++)
            {
                ElencoTipologie.TipologieODL.Add(new TipologiaViewModel());
            }
 
            foreach (var tipologia in ElencoTipologie.TipologieODL)
            {
                tipologia.Id = GetValue<string>(bindingContext,"Id");
                tipologia.Descrizione = GetValue<string>(bindingContext,"Descrizione");
                if (String.IsNullOrEmpty(tipologia.Id))
                {
                    bindingContext.ModelState.AddModelError("Id","Errore");
                }
            }
 
            return ElencoTipologie;
        }
 
 
        private T GetValue<T>(ModelBindingContext bindingContext, string key)
        {
            ValueProviderResult valueResult;
            string stringResult;
            valueResult = bindingContext.ValueProvider.GetValue(key);
            stringResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName).RawValue.ToString();
            bindingContext.ModelState.SetModelValue(key,valueResult);
            return (T)valueResult.ConvertTo(typeof(T));
        }
    }
}
Stefano
Top achievements
Rank 1
 answered on 05 Apr 2013
1 answer
63 views
Hi,

The multiselect control has a maxSelectedItems property that's available through html and JSP. Is it somehow accessible through the MVC Wrappers? After typing  "
 @(Html.Kendo().MultiSelect()"... 

there seems to be no fluent configuration for it...


Thanks
Rafael Monge
Dimiter Madjarov
Telerik team
 answered on 05 Apr 2013
7 answers
536 views
Congratulations to your Products.

When I start your demos or my test-projects there is a short rearranging of the page on Ipad. 
At the first moment, I can see the plain html output of the page and then some milliseconds later the kendouimobile-design.

There is no such ugly behavior on other browsers I tested (Android stock browser, IE and Chrome on PC)

Is there a solution against this behavior?

Thank you

Stefan
Keen
Top achievements
Rank 1
 answered on 05 Apr 2013
2 answers
198 views
Hello ,

I want to evaluate Kendo UI for our HTML 5 web application, we want to use a combination of Kendo UI and Bootstrap. Now I'm trying to install them in Visual Studio but it does not work. I am looking for a tutorial how to get started.

Thank you for your cooperation!

Sarah

AkAlan
Top achievements
Rank 2
 answered on 04 Apr 2013
3 answers
755 views
I'm trying to develop a web app that will use inline grid editing for new records and updates.

Each row of data will require around 10 numeric inputs -- the default value is zero. It's essential that users can use TAB to move to the next field and then enter the required figure as quickly as possible.

Currently, when a user tabs to the next field, the existing content is not highlighted, so they are having to either use the mouse to highlight/delete it or use the arrow keys. This is slowing down data entry considerably.

How can I highlight the cell's existing  content when the user TABs to it?

Thanks
Robert
Top achievements
Rank 1
 answered on 04 Apr 2013
2 answers
106 views
I have a ListView and Pager bound to a DataSource that gets its data from a remote url (i.e. using transport.read).  For the sake of this example we'll call the objects returned by the url and bound to the DataSource, "DataSourceObjects".  It works as expected.  

However, the ListView exists on a webpage that uses ajax to update other elements on the webpage (Call #1).  When those other elements update, the ListView must update and display data from a different page of the DataSource, based on the new values of those elements.  This means a call to DataSource.page() and thus another round-trip to the server (Call #2).  I'd like to combine Call #1 and Call #2 into one call.  I should be able to do this by sending the DataSourceObjects for the new page during Call#1 and then manually updating the DataSource with those new DataSourceObjects, bypassing the DataSource.page() call and bypassing transport.read().  I'd also need to manually update the page being displayed by the Pager attached to the DataSource, again without it making another call to the server.

I've done a lot of looking around to see how this could be accomplished but haven't found an example of what I'm describing.  I've gotten so far as to update the data being displayed by the ListView by calling DataSource.data(DataSourceObjects), but I can't get the Pager to display the right page number.  I read a suggestion to try DataSource.query({ page: NewPageNumber }) but that doesn't seem to work.

Can you tell me how to accomplish what I've described?  Thanks.


UPDATE:
I was able to use the get the .query() call working as described here (http://www.kendoui.com/forums/framework/data-source/setiing-pagesize-dynamically-causing-read-.aspx).  Calling manuallyUpdateDataSource() seems to update the data as I want it to, but the .query() line causes a server hit, which I don't want.
var myDataSource = new kendo.data.DataSource({
            pageSize: 10,
            serverPaging: true,
            transport: {
                read: {
                    url: 'http://mydataurl/',
                    headers: {
                        'X-Requested-With': 'XMLHttpRequest'  
                    }
                },
                parameterMap: function (data, type) {
                     // Code for parameterMap.
                }
            },
            schema: {
                data: 'Data',
                total: 'Total'
            },
        });
 
function manuallyUpdateDataSource(dataSourceObjects) {
     myDataSource.data(dataSourceObjects);
     myDataSource.query({ pageSize: 10, page: 3 });   // setting to page 3 just for testing.
}
Don
Top achievements
Rank 1
 answered on 04 Apr 2013
3 answers
105 views
Hi,

I have tested your Multi Select widget 
It seems to me there is a bug there :
When navigating to http://demos.kendoui.com/beta/web/multiselect/serverfiltering.html
I can see that all  products are being
downloaded to the client when the page just loads.
I would expect that no data will be downloaded to the client, and only the relevant products will be fetched as I type inside the input area (fetching seems to happen , but since all products have already
being downloaded at first hit , there is no use to download them again from the
server).
In the above sample 74 products were downloaded to the client when the widget have been loaded...

Alexander Valchev
Telerik team
 answered on 04 Apr 2013
3 answers
102 views
Hi,

We have converted the the treeview from telerik MVC to Kendo UI looks fine but how should we do operations on it after the tree is loaded ? Previously we used OnLoad event in telerik to do some operations after the tree is loaded but in Kendo no Onload event is present so we used document.ready function but it fires before the tree is loaded due to which the few steps do not work.
Other question is regarding the Kendo treeview expand and collapse animation. We need to show the + and - signs instead os the small triangle, how shall we achieve this ?

Thanks..
Dimiter Madjarov
Telerik team
 answered on 04 Apr 2013
3 answers
184 views
I'm running into this issue where the tooltip remains on the chart if I mouseover from one to another quickly. Here's a JSFiddle where the occurrence can be tested, and a screenshot of the issue.

http://jsfiddle.net/Dysch/

In our internal application, we have several charts, up to 8 on a page and this occurrence has more tooltips that remain. Screencast of issue happening in our application.

http://screencast.com/t/ObzneNk53r8

Thanks for any info and help on how to fix
David
Top achievements
Rank 1
 answered on 04 Apr 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
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
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?