Telerik Forums
UI for ASP.NET MVC Forum
1 answer
76 views
@(Html.Kendo().Grid<sss.ViewModels.StudentMarkVM>()
 
               .Name("grid")
               .Columns(columns =>
               {
 
                   columns.ForeignKey(c => c.StudentId, (System.Collections.IEnumerable)ViewData["students"], "Id", "NameEn");
                   columns.Bound(c => c.Name).Hidden();
                   columns.ForeignKey(c => c.MarkStructureId, (System.Collections.IEnumerable)ViewData["markStructures"], "Id", "NameEn");
                   columns.Bound(c => c.Mark);
                   columns.Bound(c => c.FullMark);
                   //.ClientTemplate(Html.Kendo().NumericTextBox<double>()
                   //                            .Name("Mark_#=Mark#")
                   //                            //.Value("#=order#")
                   //                            .HtmlAttributes(new { value = "#=Mark #" })
                   //                            .Format("{0:n0}")
                   //                            .Min(0)
                   //                            .Max(100000)
                   //                            .Step(1)
                   //                            .Decimals(0)
                   //                            .Events(ev => ev.Change("numericBoxChanged"))
                   //                            .ToClientTemplate().ToHtmlString());
                   columns.Bound(c => c.IsActive).Hidden();
                   columns.Bound(c => c.Note).Hidden();
                   columns.Bound(c => c.UserDefined1).Hidden();
                   columns.Bound(c => c.UserDefined2).Hidden();
                   columns.Bound(c => c.UserDefined3).Hidden();
                   columns.Bound(c => c.UserDefined4).Hidden();
                   //columns.Bound(c => c.CreationUserName).Hidden();
                   //columns.Bound(c => c.CreationDate).Hidden().Format("{0:MM/dd/yyyy H:mm}");
                   //columns.Bound(c => c.LastUpdateUserName).Hidden();
                   //columns.Bound(c => c.LastUpdateDate).Hidden().Format("{0:MM/dd/yyyy H:mm}");
 
               })
              .ToolBar(toolbar =>
              {
                  toolbar.Save();
                  toolbar.Excel();
                  toolbar.Pdf();
              })
              .ColumnMenu()
              .Editable(editable => editable.Mode(GridEditMode.InCell))
          .HtmlAttributes(new { style = "height: 500px" })
              .Selectable(selectable =>
              {
                  selectable.Mode(GridSelectionMode.Single);
                  selectable.Type(GridSelectionType.Cell);
              })
              .Sortable(sortable =>
              {
                  sortable.SortMode(GridSortMode.SingleColumn);
              })
              .HtmlAttributes(new { style = "height: 500px" })
          .Events(ev => ev.DataBound("db"))
              .Filterable()
              .Scrollable()
             .DataSource(dataSource => dataSource
         .Ajax()
         .Model(model =>
         {
             model.Id(p => p.Id);
             model.Field(p => p.StudentId).Editable(false);
             model.Field(p => p.Name).Editable(false);
             model.Field(p => p.MarkStructureId).Editable().Editable(false);
 
         })
        .Read(read => read.Action("StudentMarks_Read2", "StudentMarks", Model))
         //.Update("StudentMark_Update", "StudentMarks")
         .Update(update => update.Action("StudentMark_Update", "StudentMarks"))
 
         )
    )
Georgi
Telerik team
 answered on 07 Aug 2018
3 answers
150 views

Hi everyone, I'm new in Kendo ASP.NET and I would like to see if some one could help me or give me an a guide. Rigth now I'm trying to implement an excel export of a pivotGrid. I already set all the pivotgrid configuration as in Razor as in the controller but when ran it I got the error (ScreenShot Attached).

The following is the configuration of the pivotGrid the View and Controller.

 

View:

@ModelType IEnumerable(Of TelerikMvcVB.HomeModel)

<link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />

@* Content-box fixes as per http://docs.telerik.com/kendo-ui/third-party/using-kendo-with-twitter-bootstrap article  *@
<link href="@Url.Content("~/Content/box-sizing-fixes.css")" rel="stylesheet" type="text/css" />

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

<link href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.common-bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
<link href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://kendo.cdn.telerik.com/2018.2.620/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.2.620/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.2.620/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.2.620/js/kendo.aspnetmvc.min.js"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
<script src="~/Scripts/kendo/jszip.min.js"></script>


<div>
    <div style="margin-top:-2%">
        <h2>Kendo PivotGrid - Razor</h2>
    </div>
    <button id="export" class="k-button k-button-icontext hidden-on-narrow"><span class="k-icon k-i-excel"></span>Exportar Excel</button>
    <div class="responsive-message"></div>

    <div>
        @(Html.Kendo().PivotConfigurator().Name("configurator") _
                    .HtmlAttributes(New With {.class = "hidden-on-narrow"}) _
                    .Filterable(True) _
                    .Sortable() _
                    .Height(570)
        )

        @(Html.Kendo().PivotGrid(Of HomeModel)() _
                            .Name("pivotgrid") _
                            .Excel(Function(excel) excel _
                                .FileName("PruebaExcelRazor.xlsx") _
                                .ForceProxy(Url.Action("Excel_Export_Save", "Home"))) _
                            .HtmlAttributes(New With {.class = "hidden-on-narrow"}) _
                            .Sortable() _
                            .Configurator("#configurator") _
                            .ColumnWidth(120) _
                            .Height(570) _
                            .BindTo(Model) _
                            .DataSource(Function(dataSource) dataSource _
                                .Ajax() _
                                .Schema(Function(schema) schema _
                                .Cube(Function(cube) cube _
                                    .Dimensions(Function(dimensions) _
                                    {
                                        dimensions.Add(Function(model) model._nombre).Caption("Nombre"),
                                        dimensions.Add(Function(model) model._idProductos).Caption("Id Producto"),
                                        dimensions.Add(Function(model) model._precio).Caption("Precio"),
                                        dimensions.Add(Function(model) model._cantidad).Caption("Cantidad")
                                    }) _
                                    .Measures(Function(measures) measures.Add("Contar Productos").Field(Function(model) model._idProducto).AggregateName("Count"))
                            ))))

        )

    </div>
</div>

@Scripts.Render("~/bundles/bootstrap")
@*@RenderSection("scripts", required:=False)*@

<style>
    #pivotgrid {
        display: inline-block;
        vertical-align: top;
        width: 70%;
    }

    #configurator {
        display: inline-block;
        vertical-align: top;
    }

    .hidden-on-narrow {
        display: inline-block;
        vertical-align: top;
    }
</style>

<script>
    $(function () {
        $("#export").click(function () {
            $("#pivotgrid").getKendoPivotGrid().saveAsExcel();
        });
    });

    function onError(e) {
        alert("error: " + kendo.stringify(e.errors[0]));
    }
</script>

 

Controller:

Imports System.Runtime.InteropServices
Imports System.Web
Imports Kendo.Mvc.Extensions
Imports Kendo.Mvc.UI


Public Class HomeController
    Inherits System.Web.Mvc.Controller

    Function Index() As ActionResult
        Dim DA As New DataAccess
        Dim lstProductos = DA.GetProductList()
        Return PartialView("~/Views/Home/Index.vbhtml", lstProductos)
    End Function

    <HttpGet>
    Function Excel_Export() As ActionResult
        Return View()
    End Function


    <HttpPost>
    Function Excel_Export_Save(ByVal contentType As String, ByVal base64 As String, ByVal fileName As String) As ActionResult
        Try
            Dim fileContents = Convert.FromBase64String(base64)
            Return File(fileContents, contentType, fileName)
        Catch ex As Exception

        End Try
    End Function


    Function ListGetData() As ActionResult
        Try
            Dim DA As New DataAccess
            Dim lstProductos = DA.GetProductList()
            Return View("~/Views/Home/Index.vbhtml", lstProductos)
            'Return lstProductos
        Catch ex As Exception
            ' Return HttpStatusCodeResult(400, "")
        End Try
    End Function
End Class

Thanks for any help about the error..I made the code from the example of the web page from the remote binding

 

 

 

Boyan Dimitrov
Telerik team
 answered on 07 Aug 2018
1 answer
472 views

Hi, 

 

How can i export selected Grid rows to XML file with specific format?

 

 

Konstantin Dikov
Telerik team
 answered on 07 Aug 2018
3 answers
213 views

Hello

I had in mind to use it with "incell" edition, is there any built in custom validation as with the grid, since I can not rely on the model validation?

Thank you very much !!

Tsvetina
Telerik team
 answered on 03 Aug 2018
5 answers
836 views

I'm trying to add a toolbar Template to the MVC Grid toolbar in addition to the Excel button.

When I add the template, the Excel button disappears. 

How can I have both?

Code below.

Thanks!

.ToolBar(toolbar =>
{
    toolbar.Excel();
    toolbar.Template("<button type='button' onclick='customCommand()'>Button Here</button>");
})

 

Georgi
Telerik team
 answered on 03 Aug 2018
2 answers
440 views
I have found an issue with the Grid using in-line editing - and it only seems to happen in the Edge browser.  A user will enter/edit data and press the TAB key (to leave the field) and the data disappears.  I also tried the demo (https://demos.telerik.com/aspnet-mvc/grid/editing) and was able to replicate the issue.  It only appears to happen when a user tabs out of the field, if they click out of the field the changes remain (as a dirty cell).  Is there a workaround for this?
Michael
Top achievements
Rank 1
 answered on 02 Aug 2018
1 answer
266 views

I am currently new to Kendo and the Scheduler Component and was wondering whether I can customize the daily working hours per work day. Let’s say that I’d like Monday’s working hours to start from 7:00 till 19:00. I then would Like Tuesday’s working hours to start from 19:00 and end at 07:00.

A possible solution is to have custom working hours per day.

Another possible workaround is to have a customized appointment block built that would have a class working similarly as the k-nonwork-hours css class. In this scenario, I want to be able to color the number of columns with the retrieved working hours, to show the user that he has an appointment on that day.

Can you please point me in the right direction as to how this can be achieved?

Neli
Telerik team
 answered on 02 Aug 2018
6 answers
1.4K+ views

Hi there,

So I was working on a solution for required checkbox, Terms and Conditions. 

You know, where you must check it so you can submit a form. 

So I was using all the Telerik components (Data Access ORM, ASP.NET MVC UI) and build the form like so. 

And I really want to get the checkbox must be checked. I tried following this tutorial below:

http://jasonwatmore.com/post/2013/10/16/aspnet-mvc-required-checkbox-with-data-annotations

And I have tried all the methods there, it does not work. The form would still be able to submit without checkbox being checked.

I am thinking if there is something special about Telerik that I can't get it working?

Help would be really appreciated! Thank you.

 

 

Kendo.MVC version is 2016.2.607.440. 

.Net 4.5

If you need more information please let me know.

Ianko
Telerik team
 answered on 02 Aug 2018
1 answer
843 views

Hello,

Currently I am trying to get the state of a checkbox that is set to indeterminate. I have a list of TreeNodes and am iterating through each node and adding information from each node to a list. Currently it is adding information based off of if the node is checked.

We have found we need to also include if the node's checkbox is set to indeterminate as well.

I know I can get this value in a roundabout way using JQuery but am interested in seeing if you have any built in functionality or other ways to get if the checkbox is set to indeterminate.

Thanks!

Attila Antal
Telerik team
 answered on 01 Aug 2018
3 answers
125 views

Hi, I'm struggling with something that should be easy, so I hope you can point to something stupid I'm doing wrong.

I have this MultiSelectFor.  When I go the GetCertifications method, I am returning the expected number of results, yet the display shows undefined for each one.  I'd expect that to happen if the fields were misnamed, but as far as I can tell I'm getting them correctly with the appropriate names.

 

@(Html.Kendo().MultiSelectFor(m => m.CertificationList)
                      .DataTextField("CertTitle")
                      .DataValueField("Id")
                      .Placeholder("Select Certifications...")
                      .AutoBind(false)
                      .MinLength(3)
                      .Filter(FilterType.Contains)
                      .DataSource(source =>
                      {
                          source.Read(read =>
                          {
                              read.Action("GetCertifications", "DemandForecastInfoSummary");
 
                          })
 
                      .ServerFiltering(true);
                      })
                  )

 

public ActionResult GetCertifications(string text)
      {
          if (string.IsNullOrEmpty(text))
          {
              return Json("", JsonRequestBehavior.AllowGet);
          }
          var rtnValue = new SelectList( DemandPlanService.GetAllCertifications(text).ToList(),"Id","CertTitle");
            
          return Json(rtnValue, JsonRequestBehavior.AllowGet);
      }

 

Nencho
Telerik team
 answered on 01 Aug 2018
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?