Telerik Forums
UI for ASP.NET MVC Forum
11 answers
99 views

Hi I have a grid with a edit pop up.All works as expected till the user puts a script in the edit fields.On lose focus this executes the script for some reason.I have even written my own custom validation which removes this from the field but when the validator returns it executes the payload(kk</script><img src=1 onerror='alert(223)'/>).What happens in the background of the editor on focus out because my validator changes do not make a difference

 

Any help would be greatly appreciated as I have tried everything but the alert still appears..Even when the text has been removed from the textfield

Ethan
Top achievements
Rank 1
 answered on 30 Mar 2020
6 answers
1.4K+ views
I have a question. I have a rather large dataset (~ 1M records) containing track and trace log messages. The average number of messages per T&T code lies around 20 records. I have a page on which these log messages for a specified T&T code are displayed using a Kendo MVC Grid, without pagination (and no pagination is intended here). As the table is getting bigger, the web app response becomes slower and slower.

I have done some profiling, and it turns out that the Json(result.ToDataSourceResult(request)) invocation in the Get ActionResult produces two queries. The first one is a (very slow, ~ 18 s) query which seems to take care of the 'Total'-property in the DataSource result. The second one is a much faster (~ 150 ms) query getting the actual records.

Since we don't need pagination on this specific grid, I don't really understand why the total count is needed anyway. Can't Kendo be smart enough to skip getting the total count when we don't need it?

I have searched the internet, and it seems like there are more people experiencing the same thing: http://stackoverflow.com/questions/15843703/kendo-mvc-todatasourceresult-extremly-slow-with-large-iqueryable
The reactions there suggest to create a custom binding, but I would really prefer not to enter that path..

Is there a solution for this?
Tsvetomir
Telerik team
 answered on 30 Mar 2020
6 answers
792 views

I have kendo mvc grid with inline edition. I want to edit my values in grid but when i click on combobox value and change it. It's not changing row value return old existing value
How can i solve this?
Here my grid and Templates

@(Html.Kendo().Grid<MockUpForeNet.Controllers.CardDetailController.Limits>()
        .Name("limitgrid").AutoBind(true)
        .DataSource(dataBinding => dataBinding.Ajax()
        .Read("GridLimitBinding", "CardDetail",new { rule = rule }).Update("UpdateLimit", "Transaction")
        .Model(keys =>
        {
            keys.Id(c => c.Id);
            keys.Field(c => c.Id).Editable(false);
            keys.Field("DurationType", typeof(string)).Editable(true);
            keys.Field("DurationValue", typeof(string)).Editable(true);
            keys.Field("ValueType", typeof(string)).Editable(true);
            keys.Field("MaxValue", typeof(string)).Editable(true);
 
        }).Batch(true).ServerOperation(false)
        )
        .Events(e => e.DataBound("hidecolumn1"))
        .Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
        .ToolBar(commands =>
        {
            commands.Create().Text(" ");
            commands.Save().SaveText(" ").CancelText(" ");
        })
        .Columns(columns =>
        {
            columns.Bound(e => e.MaxValue).Width(200).Title("Limit").ClientTemplate("#= ValueType == 'Amount' ? Row(MaxValue) : RowLiters(MaxValue) #");
            columns.Bound(e => e.ValueType).Width(200).Title("Type").EditorTemplateName("ValueType");
            columns.Bound(e => e.DurationValue).Width(200).Title("Duration");
            columns.Bound(e => e.DurationType).Width(200).Title("Duration Type").EditorTemplateName("DurationType");
            columns.Bound(e => e.Id).Visible(false);
            columns.Bound(e => e.Id).Width(80).ClientTemplate("<img src='../../assets/images/icons/delete.svg' id='#=Id#' />").Filterable(false).IncludeInMenu(false).Title(" ");
        })
        //.Selectable()
        .Sortable()
        .Navigatable(configurator => configurator.Enabled(true))
 
 
 
         ///My editor templates
          @(Html.Kendo().ComboBox()
                .Name("cbvaltype")
                .Items(i =>
                {
                    i.Add().Text("Quantity").Value("Quantity");
                    i.Add().Text("Amount").Value("Amount");
                })
            )
 
            @(Html.Kendo().ComboBox()
                    .Name("cmbdurationtype")
                    .Items(i =>
                        {
                        i.Add().Text("Hour").Value("Hour");
                        i.Add().Text("Day").Value("Day");
                        i.Add().Text("Week").Value("Week");
                        i.Add().Text("Month").Value("Month");
                        i.Add().Text("Year").Value("Year");
                    })
              )
Adil
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 30 Mar 2020
2 answers
475 views
I'm having an issue with grids when I re-size the columns. If my grids have 4 or fewer columns they jump to a much larger size when you try to re-size them. This also causes the grid before them to shrink. I'm wondering if this is a column width issue or something I might be missing.

 @(Html.Kendo().Grid<DST.DTOs.CoreDTO.ClassificationTypeViewModel>()
                      .Name("ClassificationTypeGrid")
                      .ToolBar(toolBar => toolBar.Template("<a class='btn btn-primary' title='Create New' onclick='classCreateItem()' href='#'>Create Classification Type</a>"))
                      .HtmlAttributes(new { style = "height:90%" })
                      .Columns(columns =>
                      {
                          columns.Bound(p => p.Id)
                              .Width(20)
                              .Filterable(false)
                              .Sortable(false)
                              .Title("Actions")
                              .IncludeInMenu(false)
                              .ClientTemplate("<a href=\"javascript: void(0);\" onclick=\"classEditItem('#: Id #');\" title=\"Edit\"><i class=\"fa fa-pencil-square-o fa-lg\"></i>     <span class=\"sr-only\"></span></a>" +
                                              " " +
                                              "# if (timesUsed == 0) { #" +
                                              "<a href=\"javascript: void(0);\" onclick=\"confirmDeleteType('#: Id #'" + "," + "'#: Title #');\" title=\"Delete\"><i class=\"fa fa-trash-o fa-lg\"></i><span class=\"sr-only\"></span></a>" +
                                              "# } else if (timesUsed > 0) { #" +
                                              "<i class=\"fa fa-trash-o fa-lg\" title=\"Classification Type is assigned to a group\"></i>" +
                                              "# } #");
                          columns.Bound(p => p.Title)
                              .Width(100)
                              .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
                          columns.Bound(p => p.ProtectionLevel)
                              .Width(100)
                              .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
                      })
                      .Pageable(page => page
                          .Refresh(true)
                          .PageSizes(true))
                      .Sortable(sort => sort
                          .SortMode(GridSortMode.MultipleColumn))
                      .Scrollable(o => o.Height("100%"))
                      .Filterable(filter => filter.Mode(GridFilterMode.Row))
                      .ColumnMenu()
                      .Resizable(resizable => resizable.Columns(true))
                      .DataSource(data => data
                          .Ajax()
                          .Read("GetClassifications", "Classifications")
                      )
            )
durby
Top achievements
Rank 1
 answered on 28 Mar 2020
1 answer
112 views
We have around 15 rooms in our building and we are using the Scheduler to show the room bookings. I'm using the resources feature to group by RoomID and show the calendar by Room. It works fine and displays correctly in the Day view but since there are 15 rooms, the week/month views are cramped so I was wondering if I can use the resources feature and grouping for the Day view and remove them for the Week/Month views. Is that possible? 
 
@(Html.Kendo().Scheduler<SchedulerViewModel>()
          .Name("Scheduler")
          .Date(DateTime.Today)
          .AllDaySlot(true)
          .Group(g => g.Resources("RoomID").Date(true))
          .Editable(w => w.Update(false).Create(false).Destroy(false))
          .Views(views =>
          {
              views.DayView(weekView => weekView.StartTime(06, 00, 00).EndTime(19, 00, 00).Selected(true));
              views.WeekView(weekView => weekView.StartTime(06, 00, 00).EndTime(19, 00, 00));
          })
          .AutoBind(false)
          .Resources(resource =>
          {
              resource.Add(m => m.RoomID)
              .DataTextField("Text")
              .DataValueField("Value")
            .DataSource(d => d.Read(read => read.Action("GetRooms", "DataSource")));
          })
          .DataSource(d => d
              .Model(m =>
              {
                  m.Id(f => f.RoomID);
                  m.Id(f => f.Id);
                  m.Field(f => f.Start);
                  m.Field(f => f.End);
              })
              .Read(read =>
              read.Action("GetCalendarSchedule", "DataSource")
              )
          ))
)
Dimitar
Telerik team
 answered on 27 Mar 2020
1 answer
307 views

I am asking if there is a tool for word processing files like word , i know that the default editor has many text manipulation options but i want the microsoft word interface with its tabs and page interface, with its ruler and so .
these are the main functionalities that i want to check if they are found in UI for ASP.Net MVC:

1- insert photo
2- modify margin
3- modify header and footer
4- word alike

5-insert file

thanks

Petar
Telerik team
 answered on 27 Mar 2020
1 answer
298 views

have a simple grid that when I export to PDF the filter ros andboxes are on the PDF,    How do I exclude these from the PDF document.

This is a MVC web app.

 

Thanks in advance

 

@(Html.Kendo().Grid< ShitTruckLibrary.Models.Contact>()
        .Name("WorkGrid")
          .ToolBar(tools => tools.Pdf())
        .Pdf(pdf => pdf
            .AllPages()
            .AvoidLinks()
            .PaperSize("A4")
            .Scale(0.8)
            .Margin("2cm", "1cm", "1cm", "1cm")
            .Landscape()
            .RepeatHeaders()
            .TemplateId("page-template")
            .FileName("Kendo UI Grid Export.pdf")
            .ProxyURL(Url.Action("Pdf_Export_Save", "Grid"))
            
        )
        .Columns(columns =>
        {
            columns.Bound(c => c.id).Hidden();
            columns.Bound(c => c.ForeName).Title("Forename").Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
            columns.Bound(c => c.SurName).Title("Surname").Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
            columns.Bound(c => c.CompanyName).Title("Customer").Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
            columns.Bound(c => c.Address1).Title("Address 1").Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
            columns.Bound(c => c.Address2).Title("Address 2").Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
            columns.Bound(c => c.Phone1).Title("Phone 1");
            columns.Bound(c => c.Phone2).Title("Phone 2");
        })


        .HtmlAttributes(new { style = "height: 50vh;" })
        .Scrollable()
        .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
        .Sortable()
        .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .ButtonCount(5))

        .DataSource(dataSource => dataSource
                .Custom()

                .PageSize(50)
                .Transport(transport =>
                {

                    transport.Read(read => read.Url("getwork").Data("getSearch").Type(HttpVerbs.Get));
                })
            )


        )

 

Petar
Telerik team
 answered on 26 Mar 2020
5 answers
1.1K+ views

Hi,

I want to be able to hide the category axis on a line chart that doesn't have any data. Please see the attached; as you can see, there are a lot of dates in the middle that don't have any data as there isn't a point plotted, yet the date is still shown in the category axis and there is space reserved for it in the actual graph.

This looks untidy so we need to be able to hide all of the dates that don't have any data/a point. So for example anything from the 9th of July to the 19th of August should be completely hidden from the chart. How can we achieve this?

The current code:

<code>

Html.Kendo().Chart(Model.OutletColdTemperatures)
                .Name("OutletTemperatureMonitoringCold") // The name/ID.
                .ChartArea(chartArea => chartArea.Background("#ADD8E6")) // Background colour.
                .Title(title => title
                    .Text("Cold Temperatures") // Control the title at the top of the graph.
                    .Color("#2E5A78")
                    .Font("bold 24px Arial, Helvetica, sans-serif")
                    .Position(ChartTitlePosition.Top)
                )
                .DataSource(ds => ds
                    .Group(g => g.Add(d => d.SystemRef)) // This tells it to create a new/group each line by the System Ref.
                    .Sort(g => g.Add(d => d.SystemRef))
                )
                .SeriesDefaults(seriesDefaults => seriesDefaults
                    .Line().Style(ChartLineStyle.Smooth) // This controls the type of line shown.
                )
                .Series(series => series
                    .Line(value => value.Temp, date => date.Recorded) // This controls the line written out.
                    .Name("#: group.value #") // Control the value shown in the Key/Legend.
                    .Labels(labels => labels.Visible(false)) // Hide temperatures on the graph.
                    .MissingValues(ChartLineMissingValues.Interpolate) // Control how missing values are shown.
                )
                .CategoryAxis(axis => axis // This controls the category at the bottom. Currently shows the date.
                    .Title("Date")
                    .Type(ChartCategoryAxisType.Date)
                    .Categories(c => c.Recorded)
                    .Labels(labels => labels
                        .Rotation(-65) // Rotate the text around.
                        .Template("#: value.toLocaleDateString() #") // Format the date shown.
                    )
                )
                .ValueAxis(axis => axis // This controls the value at the left side. Currently shows the temperature.
                    .Numeric()
                    .Title("Temperature &deg;C")
                    .PlotBands(p => p
                        .Add(10, 10.2, "#FF0000")
                    )
                    .Max(20) // Set the maximum value shown at the top of the graph.
                )
                .Legend(legend => legend // This controls the Key/Legend. Currently shows the Outlet System Ref.
                    .Visible(false)
                    .Position(ChartLegendPosition.Bottom)
                    .Labels(x => x.Font(font: "9px Arial, Helvetica, sans-serif").Template("#: text #"))
                )
                .Tooltip(tooltip => tooltip // Add a tooltip showing the Outlet details.
                    .Visible(true)
                    .Template(tooltipTemplate)
                )
                .Events(events => events
                    .DataBound("OnDataBound_OutletTemperatureMonitoring")
                )

</code>

Any help would be appreciated. I think the same question has been answered here, however the response was a couple years ago: www.telerik.com/forums/hide-labels-on-date-axis-that-have-no-data#BFCuWHL3s0i8c7DX1uPcdw

Thanks

Alex Hajigeorgieva
Telerik team
 answered on 25 Mar 2020
6 answers
240 views

As pictured, I have 2 grids next to each other.  On the left, I have a list of people who are in a group.  On the right, I have a list of people who are not in the group but instead are candidates that could be added.  I need to add people to the group by selecting one or multiple on the right grid then, on button press, all users should be should be added to the group.  In the same way, those who are members of the group should be selectable in the same way and on button press, I should be able to remove all selected members.

Do you have a working example of this type of behavior?  Where do I put the Add/Delete buttons?  Must they be a custom button built into the grid or can they be separate from the grid?   Must I perform a round-trip refresh after an Add/Delete action or can the control remain in play on the client?

Thanks in advance for your help,

Joel

Silviya Stoyanova
Telerik team
 answered on 25 Mar 2020
9 answers
688 views

Hello,

in my application I use a grid that works with client detail template via ClientDetailTemplateId property. In the client detail template I want to show a label with german umlauts like:

@Html.Label("olb_currentaccount_overdraftcommission", "Überziehungsprovision", new { @class = "detail-label" })

Whenever there is a german umlaut in the label text I receive an invalid template exception. The raw HTML code looks like this:

<label class="detail-label" for="olb_currentaccount_overdraftcommission">&';220;berziehungsprovision</label>

 

Is there any way to use german umlauts for a HTML label in a client detail template?

Any help is appreciated.

Regards

Raphael

Daniel
Top achievements
Rank 1
Iron
 answered on 23 Mar 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?