Telerik Forums
UI for ASP.NET MVC Forum
2 answers
134 views
When I group the Grid, the vertical lines are broken that separates the columns. Is there a way to force the Grid to have those lines not broken by the grouping rows. Please see attached Image.

VP
Top achievements
Rank 1
 answered on 17 Nov 2014
1 answer
82 views
I have just migrated an ASPNET application that was relying on Telerik ASPNET controls (i.e., the good'ol Rad* server controls) to ASPNET MVC using UI for ASPNET MVC. All nice & fine so far, until migrating the look&feel of the old app.
Thing is we have customized the ASPNET Rad*-controls to a high degree (using the predefined CSS classes). And since the UI for ASPNET MVC uses different styling method (Kendo UI-based, that is k-* CSS classes for most part), I am wondering if there is any tool/decently quick way to migrate the old ASPNET classes to these Kendo ones for MVC?!
Thanks in advance (and sorry if this topic already exists, but my search did not yield such results).
Sebastian
Telerik team
 answered on 17 Nov 2014
3 answers
147 views
Hi
I am looking for same functionality of Telerik WebMail demo (http://demos.telerik.com/aspnet-ajax/webmail/default.aspx) but in MVC.

Do we have a same demo in MVC as well
Can we use same controls in MVC

Thanks
Sebastian
Telerik team
 answered on 17 Nov 2014
1 answer
193 views
I'm using the scheduling control for a custom application and my customers have asked to show only the US timezones, how do I go about doing this?
Atanas Korchev
Telerik team
 answered on 14 Nov 2014
1 answer
85 views
Hi,

On batch update in the grid it sends two sets of requests one to do update and another to do create
Is there a way to send only one request so that I get all the errors back in a single modelstate object

Thanks,
Annie
Nikolay Rusev
Telerik team
 answered on 14 Nov 2014
1 answer
133 views
Hi:

Is there a way we could increase the width of the vertical scroll bar in Kendo grid? What is the styling property i should use?
Can you please provide a sample snippet?

Thank You,
Arul.
Dimo
Telerik team
 answered on 14 Nov 2014
3 answers
3.4K+ views
Title:
Kendo MVC grid – how to send an ajax post from javascript (or jquery) along with currently selected row of
data from grid (without using the "update" built in button of the grid)

I tried to create hidden variables for the model that the grid is using so that
the controller can grab it, when we do an ajax post. The following code doesn’t
seem to wrok.

What am I missing?

Steps I did in my code and the questions:

-    Created submit button; when the button is clicked, it
should grab the currently selected row of data from grid and pass it to the
controller.

-    Getting the current row seems to work in the javascript I wrote below ($("#btnSearch").click)
and the ajax post goes to the conttoller. But then the model data does NOT have DisposalContainer filled in. Am I
making a mistake in ClientTemplate of mvc grid (when i am trying to make some hidden variables for the model) or am I NOT passing the DisposalContainer (or any model data would do fine) correctly?

 My model that is bound to the grid is:
    [Serializable]
    public class PackUnitModelView
    {
        public string Item;
        public int ShippedQty;
        public int ReturnedQty;
        public string ItemDescription;
        public string DisposalContainer;        // Non-Harzardous, Flammable-INC15-E2, Reactive-BPO, Flammable-AF07
    }

===================================================================================

Code in the controller:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult PackUnits_Update(PackUnitModelView packUnit, string packageID)

{

  // will do some db persistent stuff.

  Return View();

}

Code in the view (*.cshtml):

==================================================================================

    <input type="Submit" id="btnSearch" style="height:32px; font-size:14px; background-color:#3399FF" class="k-button" title="Search" value="Search" />

 

==================================================================================

    @(Html.Kendo().Grid<PackUnitModelView>()

        .Name("gridPackUnits")

        .Columns(columns =>

        {

            // do
this in case if I need to pass pacakage unique id along with each
PackUnitModel.

            //
columns.Bound(c => c.Id).Visible(false);

            columns.Bound(c =>
c.Item).Title("Item").Width(50)

                    .ClientTemplate("#= Item #" +

                            "<input type='hidden' name='PackUnitModelView[#=
index(data)#].Item' value='#= Item #' />");

 

            columns.Bound(c =>
c.ShippedQty).Title("Shipped").Width(60).HtmlAttributes(new { style = "text-align:center" })  // For text alignment on the column use the HtmlAtributes
like it is done here.

                    .ClientTemplate("#= ShippedQty #" +

                            "<input type='hidden' name='PackUnitModelView[#=
index(data)#].ShippedQty' value='#= ShippedQty#' />");

           

            columns.Bound(c =>
c.ReturnedQty).Title("Returned").Width(60).HtmlAttributes(new { style = "text-align:center" });

                    //columns.Bound(e =>
e.Industry).ClientTemplate("#= Industry #" +

                    //"<input type='hidden' name='Occupation[#=
index(data)#].Industry' value='#= Industry#' />");

           

            columns.Bound(c =>
c.ItemDescription).Title("Item
Description").Width(250);

            columns.Bound(c =>
c.DisposalContainer).Title("Disposal
Container").Width(150);

        })

       

        .HtmlAttributes(new { style = "height: 290px;"
})       //
grid height

        .Scrollable()

        .Selectable()

        //.Groupable()          // This will show the title for the
grid and the title text can be set via jscript code
"kendo.ui.Groupable.prototype.options.messages =.." below

        .Sortable()

        .RowAction(row =>

                        {

                            //if (condition) // would be check the container hazardous
stata - then color as red

                            {

                               
row.HtmlAttributes["class"] = "k-state-selected";

                            }

                        })

        .Reorderable(reorder =>
reorder.Columns(false))

        .Resizable(r => r.Columns(true))

        .Events(e => e.DataBound("DataBoundGrid"))

        .DataSource(dataSource => dataSource

            .Ajax()

            .Read(read => read.Action("PackUnits_Read", "Main"))

            .Update(update => update.Action("PackUnits_Update", "Main", new { packageID = "111-11-1111" }))

        )

    )

   ===============================================================================

Javascript functions:        

// Index function to get the dynamic value of columns and put in the hidden variable of
//html page - so that model can be bound to controller function when we do HttpPos (via ajax typically).

function index(dataItem) {

        var data = $("#gridPackUnits").data("kendoGrid").dataSource.data();

        return data.indexOf(dataItem);

    }

============================================================================
$("#btnSearch").click(function (e) {
            var grid = $("#gridPackUnits").data("kendoGrid");
            var selectedBackup = grid.dataItem(grid.select());

            if (selectedBackup == null)
                return;
            selectedBackup.dirty = true;

            $.ajax({
                type: "POST",
                url: "Main/PackUnits_Update",   // post to your controller action that does what you want
to do with the model
                dataType: "json",
                data: { DisposalContainer: 'cont', PackageID: 1234}
            });

           e.preventDefault();

        });

    });

=======================================================================

 
Petur Subev
Telerik team
 answered on 14 Nov 2014
6 answers
276 views
Hi,

I wonder if it's possible to hide a row when I'm grouping the results by column but still showing the ClientGroupFooterTemplate in my case is "Subtotal".

I attach a image to explain better the scenario.

And here's my code

@(Html.Kendo().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Template(t => { }).Title("N°").ClientTemplate("#= renderRecordNumber(data) #").Width(40);
            columns.Bound(p => p.ID_SOLICITUDSERVICIO).Visible(false);
            columns.Bound(p => p.ID_PARTESERVICIO).Visible(false);
            columns.Bound(p => p.NOMBRE_EMPRESA).Title("Cliente");
            columns.Command(command => command.Custom("custom").Text("").Click("MostrarSolicitud")).Title("N°solicitud").Width(75);
            columns.Bound(p => p.SOLICITUD_CLIENTE).Title("ODT");
            columns.Bound(p => p.NOMBRE_ESTADOSOLICITUD).Title("Estado");
            columns.Bound(p => p.SFECHA_INICIO).Title("Fecha inicio");
            columns.Bound(p => p.SFECHA_FIN).Title("Fecha fin");
            //columns.Bound(p => p.SHORA_INICIO).Title("Hora inicio");
            //columns.Bound(p => p.SHORA_FIN).Title("Hora fin");
            columns.Bound(p => p.NOMBRE_TIPOSERVICIO).Title("Tipo servicio");
            columns.Bound(p => p.NOMBRE_MARCA).Title("Marca");
            columns.Bound(p => p.NOMBRE_MODELO).Title("Modelo");
            columns.Bound(p => p.SERIE_INVENTARIO).Title("N°serie");
            columns.Bound(p => p.DOCUMENTOS_PROCESADOS).Title("Doc. procesados")
                .ClientFooterTemplate("Total: #=sum#")
                .ClientGroupFooterTemplate("Subtotal: #=sum#");
            columns.Bound(p => p.NOMBRE_UBICACION).Title("Ciudad Atención");
            columns.Bound(p => p.TECNICO_RESPONSABLE).Title("Técnico responsable");
            columns.Bound(p => p.NUMERO_TECNICOS).Title("N°técnicos");
            columns.Bound(p => p.TOTAL_HORAS).Title("Total de horas")
                .ClientFooterTemplate("Total: #=kendo.toString(sum, 'n2')# h")
                .ClientGroupFooterTemplate("Subtotal: #=kendo.toString(sum, 'n2')# h");
            columns.Bound(p => p.FACTURA_PARTESERVICIO).Title("N°factura");
        })
                       .Sortable()
                       .Pageable(m => m.PageSizes(new int[] { 10, 20, 50, 100 }))
                       .Groupable()
                       .Filterable()
                       .Events(e => { e.DataBound("dataBound"); })
                       .Scrollable(s => s.Height("auto"))
                       .TableHtmlAttributes(new { style = "table-layout: fixed;" })
                       .Resizable(r => r.Columns(true))
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .Events(ev =>
                    {
                        ev.RequestStart("Load");
                        ev.RequestEnd("Ready");
                    })
                                   .Aggregates(aggregates =>
                                   {
                                       aggregates.Add(m => m.DOCUMENTOS_PROCESADOS).Sum();
                                       aggregates.Add(m => m.TOTAL_HORAS).Sum();
                                   })
                           .Read(read => read.Action("LeerExt_MatrizServicios", "Consultas").Data("getParameter"))
               )
               .ToolBar(toolBar =>
                    toolBar.Custom()
                        .Text("Exportar a PDF")
                        .HtmlAttributes(new { id = "export" })
                                .Url(Url.Action("ExportarPDFMatrizServicios", "Consultas",
                                new
                                {
                                    page = 1,
                                    pageSize = "~",
                                    filter = "~",
                                    sort = "~",
                                    txtFechaInicio = "~",
                                    txtFechaFin = "~",
                                    txtHoraInicio1 = "~",
                                    txtHoraInicio2 = "~",
                                    id_procedenciaequipo = "0",
                                    id_cliente = "0",
                                    id_localidadequipo = "0",
                                    id_unidadnegocio = "0",
                                    id_tecnico = "0",
                                    varios_tecnicos = "0",
                                    id_tiposervicio = "0",
                                    id_marca = "0",
                                    id_modelo = "0",
                                    id_serieequipo = "0",
                                    id_estadosolicitud = "0",
                                    id_tipoatencion = "0",
                                    id_bodega = "0",
                                    uso_repuesto = "0",
                                    id_repuesto = "0",
                                    AtencionMayor = " ",
                                    AtencionMenor = " ",
                                    partes_facturados = " ",
                                    id_tecnico_involucrado = "0",
                                    nombre_cliente = " ",
                                    nombre_tecnico = " ",
                                    nombre_servicio = " ",
                                    estado_solicitud = " ",
                                    nombre_tecnico_involucrado = " ",
                                    unidad_negocio = " "
                                }))
                )
                .ToolBar(toolBar =>
                    toolBar.Custom()
                        .Text("Exportar a Excel")
                        .HtmlAttributes(new { id = "exportex" })
                                .Url(Url.Action("ExportarExcelMatrizServicios", "Consultas",
                                new
                                {
                                    page = 1,
                                    pageSize = "~",
                                    filter = "~",
                                    sort = "~",
                                    txtFechaInicio = "~",
                                    txtFechaFin = "~",
                                    txtHoraInicio1 = "~",
                                    txtHoraInicio2 = "~",
                                    id_procedenciaequipo = "0",
                                    id_cliente = "0",
                                    id_localidadequipo = "0",
                                    id_unidadnegocio = "0",
                                    id_tecnico = "0",
                                    varios_tecnicos = "0",
                                    id_tiposervicio = "0",
                                    id_marca = "0",
                                    id_modelo = "0",
                                    id_serieequipo = "0",
                                    id_estadosolicitud = "0",
                                    id_tipoatencion = "0",
                                    id_bodega = "0",
                                    uso_repuesto = "0",
                                    id_repuesto = "0",
                                    AtencionMayor = " ",
                                    AtencionMenor = " ",
                                    partes_facturados = " ",
                                    id_tecnico_involucrado = "0",
                                    nombre_cliente = " ",
                                    nombre_tecnico = " ",
                                    nombre_servicio = " ",
                                    estado_solicitud = " ",
                                    nombre_tecnico_involucrado = " ",
                                    unidad_negocio = " "
                                }))
                )
                .ToolBar(toolBar =>
                    toolBar.Custom().Text("Imprimir").Url("#").HtmlAttributes(new { @class = "btnImprimir" }))
           )

Thanks for the help I hope it's possible
Iliana Dyankova
Telerik team
 answered on 14 Nov 2014
1 answer
133 views
Hi There,

I'm trying to get a combo box to have a custom template depending on the row, as it needs to have essentially sub headers within the combobox. Currently using a non-Kendo combobox we have this however is something like this even possible within Kendo?
Alexander Popov
Telerik team
 answered on 14 Nov 2014
1 answer
89 views
Hi Team,

we are facing issues in Gantt chart. if we select first row and than second row first row is not disabled[ it is in editable mode]

kindly help us. please find the attachment for your reference.

Thanks

Manoj
Bozhidar
Telerik team
 answered on 14 Nov 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?