Telerik Forums
UI for ASP.NET MVC Forum
2 answers
199 views
VS2015 keeps nagging me to update my project with the latest version of Telerik MVC. Currently I'm using 2016.2.607. I got tired of the nagging, so I used the Upgrade wizard, and absolutely nothing in my code worked anymore.  It was by far one of the most horrible upgrade experiences.  What is the best way to update this to the latest version without having to basically re-write everything?
Dyanko
Telerik team
 answered on 10 Nov 2016
1 answer
359 views

I have a grid that has an option to export in PDF, how can i export the pdf calling a report of telerik?

The thing is that when i click the button on to export in PDF i want that the export to be with the report of telerik that i made with the telerik reports designer.

is that possible?

I hope someone can help me.

Big hugs.

Stef
Telerik team
 answered on 10 Nov 2016
3 answers
377 views

How can i export to PDF only the rows that has a column check?.

I found this example in Export to Excell http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/excel/export-checked-columns-only

Is possible to do this with PDF Export? If anyone has an example of how to do this, I will appreciate it.

Pavlina
Telerik team
 answered on 09 Nov 2016
5 answers
200 views

I am using the `scrollable.Virtual` option on my grid. What i'm trying to do is paginate 4000 rows into 50 per page and have the next set load on scroll.  The problem is that when I first load the grid it loads all 4000 records, then when i scroll to the 51st record it pulls all 4000 records again.

 

This is my code

@(Html.Kendo().Grid<EmployeeMasterView>()
              .Name("grid")
              .ToolBar(tools => tools.Excel())
              .Excel(e => e.AllPages(true))
              .Excel(excel => excel
                  .FileName("List.xlsx")
              )
              .Columns(columns =>
              {
                  columns.Bound(e => e.EmployeePicture).ClientTemplate("<img src='" + Url.Content("~/#: EmployeePicture#") + "' height='50px' width='50px' />").HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Picture", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Picture", GlobalVariables.LanguageID)).Width(100);
                  columns.Bound(e => e.FirstName).Width(120).ClientTemplate("<a href='" + Url.Action("Index", "Employees", new { E = "#: EmployeeID#", M = "Info" }) + "' >#: FirstName#</a>").HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("FirstName", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("FirstName", GlobalVariables.LanguageID));
                  columns.Bound(e => e.LastName).Width(120).ClientTemplate("<a href='" + Url.Action("Index", "Employees", new { E = "#: EmployeeID#", M = "Info" }) + "' >#: LastName#</a>").HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("LastName", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("LastName", GlobalVariables.LanguageID));
                  columns.Bound(e => e.dispEmployeeID).Width(120).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("EmployeeID", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("EmployeeID", GlobalVariables.LanguageID));
                  columns.Bound(e => e.Email).ClientTemplate("<a href='mailto:" + "#: Email#" + "' title='" + "#: Email#" + "'>" + "<i class='list-icon-mail fa fa-envelope-o fa-lg fa-fw'></i></a>").Width(100).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Email", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Email", GlobalVariables.LanguageID));
                  columns.Bound(e => e.dispDept).Width(155).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Department", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Department", GlobalVariables.LanguageID));
                  columns.Bound(e => e.StrGender).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Gender", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Gender", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.DateEmpInactivated).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Date Employee Inactivated", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Date Employee Inactivated", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.InactivatedReason).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Inactivated Reason", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Inactivated Reason", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.JobCategory).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Job Category", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Job Category", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.WorkSiteID).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("WorkSiteID", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("WorkSiteID", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.WorkSiteLocation).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Work Site Location", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Work Site Location", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.EmployeeWorkAddress).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Employee Work Address", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Employee Work Address", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.TerminationDate).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Termination Date", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Termination Date", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.disbStartDate).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Start Date", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Start Date", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.dispPos).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Position", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Position", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.SSN).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("SSN", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("SSN", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.State).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("State", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("State", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.EmployeementStatus).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Work Status", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Work Status", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.dispBirthDate).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Birthdate", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Birthdate", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.dispDOH).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Original Hire Date", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Original Hire Date", GlobalVariables.LanguageID)).Hidden(true);
                  columns.Bound(e => e.BlnInactive).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Inactive", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Inactive", GlobalVariables.LanguageID)).Hidden(true).ClientTemplate("<input type='checkbox' #= BlnInactive ? checked='checked' : '' # disabled='disabled'></input>");
                  //columns.Bound(e => e.dispDept).HeaderHtmlAttributes(new { @title = FieldTranslation.GetLabel("Dept Desc", GlobalVariables.LanguageID) }).Title(FieldTranslation.GetLabel("Dept Desc", GlobalVariables.LanguageID)).Hidden(true);
 
              })
              .Sortable()
        // .Scrollable(scrollable => scrollable.Virtual(true))
              .Scrollable(scrollable => scrollable.Virtual(true))
              .Groupable()
              .ColumnMenu()
        //.Pageable()
              .Filterable()
              .ClientDetailTemplateId("template")
              .HtmlAttributes(new { style = "height:600px;" })
              .Reorderable(reorder => reorder.Columns(true))
              .Resizable(resize => resize.Columns(true))
              .DataSource(dataSource => dataSource
                  .Ajax()
                  .PageSize(50)
                  .Read(read => read.Action("DetailTemplate_Employees", "Employees"))
 
              )
              .Events(events => events.DataBound("dataBound"))
        )

 

What I am trying to achieve is on first load it has the first 50 rows, then on scroll loads the next 50...and doesn't pull all 4000 records each time I scroll to the next 50.

Pavlina
Telerik team
 answered on 09 Nov 2016
3 answers
513 views

According to this demo here there is supposed to be a .Filter() event for the Grid.  But when I try to us it in my code, just as it is in that demo, it is undefined.  There is no Filter() event.  Or is there?  Which is it?

 

 

Eyup
Telerik team
 answered on 09 Nov 2016
9 answers
1.8K+ views

Currently, the Grid Excel export will not export columns that have a client template defined on them.

The answer from Telerik HERE, solves the issue in a static way. Meaning that for each column that has a client template definition, you will have to alter the script to add the other columns.

    function excelExport(e) {
        var sheet = e.workbook.sheets[0];
        var employeeTemplate = kendo.template(this.columns[0].template);
        var employerTemplate = kendo.template(this.columns[1].template);
        //Add more template variables and set them to the column index in the grid.

        var data = this.dataSource.view();

        for (var i = 0; i < data.length; i++) {
            sheet.rows[i + 1].cells[0].value = employeeTemplate(data[i]);
            sheet.rows[i + 1].cells[1].value = employerTemplate (data[i]);
            //Add the cell values by column index from the template v
        }
    }

 

Here is a script to dynamically get all of the columns with client templates : 

Grid HTML Helper:

 @(Html.Kendo().Grid<Employee>()
                .Name("employeeGrid")
                .ToolBar(t => { t.Create(); t.Save(); t.Excel(); })
                .Events(e => e.ExcelExport("excelExportDynamic"))
                .Columns(col =>
                {
                    col.Bound(c => c.Employee).ClientTemplate("#: data.Employee#");
                    col.Bound(c => c.Employer).ClientTemplate("#: data.Employer#);
                    col.ForeignKey(c => c.Status, Model, "StatusID", "StatusCode").Title("Status");
                    col.Command(c => c.Destroy());
                })
               //Removed for brevity

 

Javascript function:

  <script>
       function excelExportDynamic(e) {
        var sheet = e.workbook.sheets[0];
        var colTemplates = [];  //Initialize new array
        var data = this.dataSource.view();

        for (var i = 0; i < this.columns.length; i++) {
            if (this.columns[i].template) {
                colTemplates.push(kendo.template(this.columns[i].template)); //Add kendo template to colTemplate array if it exists for the given index's column
            } else {
                colTemplates.push(null); //Add null to given index if template does not exist for the column index. This ensures columns are mapped to the proper index.
            }
        }

        //colTemplate array has been built now: Example of array at this point)     colTemplate: { templateCol[0], null, templateCol[3], null, null  }

        for (var i = 0; i < colTemplates.length; i++) {
            for (var j = 0; j < data.length; j++) {
                if (colTemplates[i] != null) {
                    sheet.rows[j + 1].cells[i].value = colTemplates[i](data[j]); //Loop through all colTemplates and all data in the grid to build the excel sheet. Skip null colTemplates.
                }
            }
        }        
    }
</script>

 

Hope this helps!!!!!

Eyup
Telerik team
 answered on 09 Nov 2016
2 answers
211 views

I am currently trying to initialise the Kendo schedular in MVC (VB.Net).  I am getting the following error;

'Schema' is not a member of 'Kendo.Mvc.UI.Fluent.SchedulerAjaxDataSourceBuilder(Of TPinvestor.Models.ViewModels.PersonalFinanceManagement.SchedulerEvent)

which is in relation to line 15 below.

 

01.@Code
02.    Html.Kendo().Scheduler(Of Models.ViewModels.PersonalFinanceManagement.SchedulerEvent)() _
03.        .Name("scheduler") _
04.        .Date(New DateTime(2013, 6, 6)) _
05.        .StartTime(New DateTime(2013, 6, 6, 7, 0, 0)) _
06.        .AllDaySlot(False) _
07.        .Views(Sub(views)
08.                       views.DayView()
09.                       views.MonthView(Function(monthView) monthView.Selected(True))
10.               End Sub) _
11.        .Editable(True) _
12.        .DataSource(Sub(d)
13.                            d.Custom()
14.                            d.Batch(True)
15.                            d.Schema(Function(schema)
16.                                             schema.Model(Sub(m)
17.                                                                  m.Id(Function(f) f.Id)
18.                                                                  m.Field("title", GetType(String)).DefaultValue("No Title").From("Title")
19.                                                                  m.Field("description", GetType(String)).From("Description")
20.                                                                  m.Field("start", GetType(String)).From("Start")
21.                                                                  m.Field("end", GetType(String)).From("End")
22.                                                          End Sub)
23.                                     End Function)
24.                    End Sub) _
25.        .Render()
26. 
27. 
28.End Code

 

I have created a viewmodel that implements Kendo.Mvc.UI.ISchedulerEvent.  I have added no additional properties.  

Any help would be much appreciated.

mabs
Top achievements
Rank 1
 answered on 09 Nov 2016
5 answers
307 views

Hi, 

I've a grid with a custom editor template.

I need to open a new popup for a new record insert after the user updated o inserted the record before by clicking on a dedicated button

How can I do that?

Eyup
Telerik team
 answered on 08 Nov 2016
3 answers
324 views

Hello.

I want to use Telerik ASP.net MVC Upload control to upload large files. How to use Upload Control to split the large file into small chunks and upload to the server with IEnumerable<HttpPostedFileBase>, and then I could merge these parts into the original large file?

Dimiter Madjarov
Telerik team
 answered on 08 Nov 2016
1 answer
190 views

I created a custom editor for my Scheduler, which works well.

Then, I wanted to hide some parts of it with the help of a flag on my ViewModel like this:

<div class="k-edit-label">
@(Html.LabelFor(model => model.Title))
</div>
<div data-container-for="title" class="k-edit-field">
@(Html.TextBoxFor(model => model.Title, new { @class = "k-textbox", data_bind = "value:title" }))
</div>

if(@Model.XXX) {

<div class="k-edit-label">
@(Html.LabelFor(model => model.Description))
</div>
<div data-container-for="description" class="k-edit-field">
@(Html.TextAreaFor(model => model.Description, new { @class = "k-textbox", data_bind = "value:description", rows = 3 }))
</div>
}

But that didn't work. A debugging session shown that my XXX flag was always false. Curiously, if I'm writing something like this

<div data-container-for="xxx" class="k-edit-field">
@(Html.TextBoxFor(model => model.XXX, new { @class = "k-textbox", data_bind = "value:xxx" }))
</div>

I'm seeing the correct value (something true, something false).
So my question is: why using @Model.XXX always return false (the default value of a flag) and how then to implement the behavior I would like?
Thanks & Cheers,

Nicolas

Bozhidar
Telerik team
 answered on 08 Nov 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?