Telerik Forums
Kendo UI for jQuery Forum
1 answer
135 views
Hi,
I've been playing around with the ImageBrowser (Editor) and would love to see a variation of the ImageBrowser as a standalone widget. If I could use it without the Editor to simply select or upload an image file that would really add value to some of my applications (for which I now have to use a different tool: elFinder).

Since the ImageBrowser already exists, hopefully this would be an easy addition to the KendoUI toolset! :)
Sebastian
Telerik team
 answered on 05 Apr 2013
1 answer
155 views
I cant make the grid to update de database. i press the save button and it does nothing. 

Code for the grid: 

<!DOCTYPE html>
<html>
<head>
    <title>Customizing filter menu</title>

<link href="/styles/kendo.common.min.css" rel="stylesheet">
<link href="/styles/kendo.default.min.css" rel="stylesheet">

<script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/js/kendo.all.min.js"></script>
<script type="text/javascript" src="/js/people.js"></script>

<style>
.k-grid {
margin: 5px;
}
</style>
</head>
<body>
<div id="grid"></div>
        <script>
$(function() {
            $("#grid").kendoGrid({
                dataSource: {
                    transport: {
                        read: "data.php",
update: {
                url: "data.php",
                type: "POST"
}
                    },
       
                    schema: {
                        data: "data",
                        model: {
codmat: "codmat",
fields: {
                  codmat: { editable: false }, 
codarea:{ editable: false },
codrubro:{ editable: false },
codsubrub:{ editable: false },
secuencia:{ editable: false },
nombre:{ editable:true},
}
}
}
                },
                columns: [{ field: "codmat" }, { field: "codarea" }, { field: "codrubro" }, { field: "codsubrub" }, { field: "secuencia"}, { field: "nombre" }],

    editable: true,
navigable: true, //habilita el teclado para navegar
toolbar: ["save", "cancel"]//adds save and cancel buttons
            }); 
        });
        </script> 
</body>
</html>


Code for the database:




<?php

    $link = mysql_pconnect("localhost", "root", "") or die("Unable To Connect To Database Server");
   mysql_select_db("datos") or die("Unable To Connect To Northwind");

 
 // add the header line to specify that the content type is JSON
    header("Content-type: application/json");

    // determine the request type
    $verb = $_SERVER["REQUEST_METHOD"];

    // handle a GET 
    if ($verb == "GET") {
        $arr = array();

        $rs = mysql_query("SELECT codmat, codarea, codrubro, codsubrub, secuencia, nombre FROM mater");

        while($obj = mysql_fetch_object($rs)) {

            $arr[] = $obj;

        }
        echo "{\"data\":" .json_encode($arr). "}";
    }

// handle a POST  
    if ($verb == "POST") {

 // DISCLAIMER: It is better to use PHP prepared statements to communicate with the database. 
        //             this provides better protection against SQL injection.
        //             [http://php.net/manual/en/pdo.prepared-statements.php][4]
        // get the parameters from the post. escape them to protect against sql injection.

        $codmat = mysql_real_escape_string($_POST["codmat"]);
$nombre = mysql_real_escape_string($_POST["nombre"]);
        $rs = mysql_query("UPDATE mater SET nombre = '" . $nombre ."' WHERE codmat = " .$codmat);
if ($rs) {
        echo json_encode($rs);
    }
    else {
        header("HTTP/1.1 500 Internal Server Error");
        echo "Update failed for EmployeeID: " .$employeeId;
    }

}
 ?>

Vladimir Iliev
Telerik team
 answered on 05 Apr 2013
5 answers
1.2K+ views
Hello,
I am binding a Kendo Dropdownlist from a remote datasource just like in this example:
http://demos.kendoui.com/web/dropdownlist/remotedatasource.html

My problem is that I can't figure out a way to set the width of the dropdownlist automatically based on the largest item. Instead of having an ellipsis on the selected item or have the text wrap in the drop down options (like in the example above), I want the dropdowns width to auto adjust based on it's longest item just like a regular drop down list. Setting the css width to auto did not work for me. Setting it to 100% stretches the dropdown accross the page which i don't want either.

Is there a way to set the dropdowns width to adjust automatically based on it's items?

Thanks in advance!
Jeff
Top achievements
Rank 1
 answered on 05 Apr 2013
1 answer
133 views
I have a column chart where I would like to show extra information about the x axis categories in a tooltip. If I show all the information in the label it is too much. I also tried having the information in the tooltip for the data series, but this makes it harder to see the information pertaining to the data series point. 

Is it possible to configure a tooltip for the xaxis categories? I also need it to be dynamic based on the category.

I did try using the new tooltip control, but I couldn't figure out how to get the dynamic content.
Iliana Dyankova
Telerik team
 answered on 05 Apr 2013
4 answers
199 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.4K+ 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
68 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
542 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
208 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
777 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?