Telerik Forums
UI for ASP.NET MVC Forum
1 answer
580 views

Hello - I have a grid with a toolbar defined.  The grid is also coded to allow grouping.  The grouping option is visible, but not the toolbar.  If I disable grouping, the toolbar displays,  I have other grids coded very much the same in my project that work fine.  

What do I have wrong on this one?

Here is my code:

        <div class="row pt-4 d-none centered" id="qSecurityGridDiv">
            @(Html.Kendo().Grid<WSIPC.Web.Models_View.Security.QmlativSecurityUserList>()
                .Name("grid")
                .Columns(columns => {
                    columns.Bound(p => p.Id).Visible(false);
                    columns.Bound(p => p.UserName).Title("Username");
                    columns.Bound(p => p.LastName).Title("Last Name");
                    columns.Bound(p => p.FirstName).Title("First Name");
                    columns.Bound(p => p.Role).EditorTemplateName("DropDownRoles");
                    columns.Bound(p => p.Grade).Title("Grade Level");
                    columns.Bound(p => p.AssignedSchools).ClientTemplate("#= iterate(data)#").Title("Schools");                    
                    columns.Bound(p => p.Hsb).EditorTemplateName("DropDownIndicators").Title("HSB Access");
                    columns.Bound(p => p.HsbAdmin).EditorTemplateName("DropDownIndicators").Title("HSB Administrator Access");
                    columns.Bound(p => p.MsdAdmin).EditorTemplateName("DropDownIndicators").Title("MSD Administrator Access");
                })
                .ToolBar(toolbar =>
                {
                    toolbar.Save();
                    toolbar.Excel();
                    toolbar.Pdf();
                    toolbar.Custom().Text("Mass Change").HtmlAttributes(new { id = "massChangeQ" });
                })
                .Pdf(pdf => pdf.ProxyURL(Url.Action("Excel_Export_Save", "Grid")).AllPages().FileName("Msd Security Grid"))
                .Excel(excel => excel.ProxyURL(Url.Action("Excel_Export_Save", "Grid")).AllPages(true).FileName("Msd Security Grid"))
                .AutoBind(false)
                .Pageable()
                .Sortable()
                .Scrollable()
                .Groupable()
                .Reorderable(reorder => reorder.Columns(true))
                .Editable(editable => editable.Mode(GridEditMode.InCell))
                .Filterable()
                .HtmlAttributes(new { style = "height:750px;" })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Batch(true)
                    .PageSize(100)
                    .Read(read => read.Action("GetSecurityUsersFilteredGrid", "MsdQmlativSecurity").Data("additionalInfo"))
                    .Model(model =>
                    {
                        model.Id(p => p.Id);
                        model.Field(p => p.UserName).Editable(false);
                        model.Field(p => p.LastName).Editable(false);
                        model.Field(p => p.FirstName).Editable(false);
                        model.Field(p => p.Grade).Editable(false);
                        model.Field(p => p.AssignedSchools);
                    })
                    .Update("UpdateSecurityGridGroup", "MsdQmlativSecurity")
                    .Events(e => e.Sync("sync_handler"))
                 )
                .Events(events => events.Edit("onEdit"))
            )
        </div><!-- end grid row-->
     

I've attached screen shots with grouping enabled and with it not.

Thanks for any help.

 

Lisa

Anton Mironov
Telerik team
 answered on 07 Dec 2021
1 answer
1.8K+ views

I am using mvc and using the server as a datasource.  I am trying to change the color of the column based on the value  . I tried to many finding on the net but none is working see at least two of them in the code below.   

 

//This example doesn't do anything.

columns.Bound(p => p.balance).Width(120).Sortable(false).Template(@<text>
                                                                                       @if (item.balance< 0)
                                                                                       {
                                                                                           <div style="background-color: Red;">
                                                                                               @item.balance;

                                                                                           </div>
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           <div style="background-color: Green;">
                                                                                               @item.amount_residence
                                                                                           </div>
                                                                                       }
                                                                                    </text>);

       //This below example throw an error

@(Html.Kendo().Grid(Model)
    .Name("grid").CellAction(cell =>
    {
        if (cell.Column.Title.Equals("balance"))
        {
            if (cell.DataItem.balance != null && cell.DataItem.balance.Value < 0)
            {
                cell.HtmlAttributes["style"] = "background-color: red";
            }
        }
    })
    .Columns...
Ivan Danchev
Telerik team
 answered on 01 Dec 2021
1 answer
157 views

Hi Sir, 

In the MVC scheduler, I want to change the text of the SAVE button to text when I am using the addEvent functionality. It is simply a create appointment template.

I am doing like this and it is not working-

$('.k-edit-buttons k-state-default k-button k-primary k-scheduler-update k-button-text').text("Confirm");

 

Could you please suggest to me how I change the text of that button?

For your reference, I am attaching the screenshot so that you will get to know where I want to change, and I will also put a screenshot of the coding.

Petar
Telerik team
 answered on 30 Nov 2021
1 answer
339 views

Simple question: what NuGet files and namespaces contain the "ToPagedList" methods?

Detail:

New to Telerik, new to these Forums, but thrilled they are here. I have what SHOULD be a simple question...

Web Application written 4 years ago using Telerik ASP.NET MVC (I think) and Telerik Kendo (I think). The 2017 App is running in production, but I need to make changes in the code (new feature stuff). Meanwhile, the guy who wrote it is no longer here - there is no one left who has touched it. Undocumented, of course. And we have moved from Visual Studio 2017 to Visual Studio 2019.

So I am trying to get the application to build pretty much "as is" so I can tinker with it and see how it works, and figure out exactly where I need to make changes. First build had 274 errors, then 64 errors... now down to 1 error in two places in one class; a reference to "ToPagedList" which is a method apparently used to pluck a specified page or pages from a result set for rendering (in a Grid?). Virtually all of that was uninstalling and reinstalling NuGet files because somehow they lost their initialization in the app files. So, plenty of places I could have gone awry.

"ToPagedList" works on a View derivative class; but apparently I am not including the proper Telerik references and libraries to get these two references to "ToPagedList" to resolve. Probably have some class confusion as well (something referencing Microsoft instead of Telerik). 

The first of the two errors, other is basically identical in the same class:

Severity Code Description Project File Line Suppression State
Error CS1061 'IQueryable<IncidentDetailView>' does not contain a definition for 'ToPagedList' and no accessible extension method 'ToPagedList' accepting a first argument of type 'IQueryable<IncidentDetailView>' could be found (are you missing a using directive or an assembly reference?) QCWeb D:\QCWeb\QCWeb\Controllers\ReportController.cs 248 Active

Line 248 looks like:

return View(tickets.ToPagedList(pageNumber, pageSize));

where tickets is an instantiation of the "IQueryable<IncidentDetailView>",

and IncidentDetailView is partial class that contains the Entity Framework record field definitions for a database pseudo-table (query results).

If I could figure out which Telerik library that this method is defined in, I can probably work back to get other references properly aligned as well (ever the optimist). I am just not having much luck searching the Telerik documentation for class method lists and descriptions, nor am I having much luck playing library roulette. Any ideas?  Thanks!!

Ivan Danchev
Telerik team
 answered on 29 Nov 2021
0 answers
109 views

Hi,

We have a scheduler with two views - a week view and a timeline view.  When in the week view all events seem to show - however when in the timeline view any event that finishes on the day in question disappears.  The start date does not seem to matter.  For events that cross days they appear on any day that isnt the end date - so for example if i have an event that starts Monday through to Thursday the event will show on Monday, Tuesday and Wednesday but not Thursday.  Navigating to Thursday does display the event briefly but then the event disapears.  

The Razor code for the scheduler is:

 


@(Html.Kendo().Scheduler<F0CUSWeb.Models.PlanningScheduleViewModel>()
                .Name("apptScheduler")
                .AutoBind(true)
                .HtmlAttributes(new { style = "height: 80vh;" })
                .MajorTick(120)
                .Editable(editable =>
                {
                    editable.Destroy(false);
                    editable.Move(false);
                    editable.Resize(false);
                    editable.Confirmation(true);
                })
                .Views(views =>
                {
                    views.TimelineWeekView(timeline =>
                    {
                        timeline.DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd MMM yy')#</span>");
                        timeline.MajorTimeHeaderTemplate("<span class='k-link k-nav-day' style='font-size:12px'>#=kendo.toString(date, 'HH:mm')#</span>");
                        timeline.Title("Week View");
                        timeline.ColumnWidth(30);
                        timeline.MajorTick(480);
                        timeline.WorkDayStart(new DateTime(2010, 1, 1, 0, 0, 0));
                        timeline.WorkDayEnd(new DateTime(2010, 1, 1, 23, 59, 59));
                        timeline.ShowWorkHours(false);
                    });
                    views.TimelineView(timeline =>
                    {
                        timeline.DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd MMM yy')#</span>");
                        timeline.MajorTimeHeaderTemplate("<span class='k-link k-nav-day' style='font-size:12px'>#=kendo.toString(date, 'HH:mm')#</span>");
                        timeline.Title("Day View");
                        timeline.StartTime(new DateTime(2010, 1, 1, 6, 0, 0));
                        timeline.EndTime(new DateTime(2010, 1, 1, 20, 0, 0));
                        timeline.ColumnWidth(20);
                        timeline.MajorTick(60);
                    });
                })
                    .Events(e =>
                    {
                        e.DataBound("apptSchedulerBound");
                        e.Navigate("onSchedulerNavigate");
                    })
                    .DataSource(ds =>
                    {
                        ds.Events(events =>
                        {
                            events.Error("endAnimation");
                        });
                        ds.Read(read => read.Action("GetSchemeSchedule", "Planning").Data("schemeScheduleString"));
                    })
                    .Group(group => group.Resources("Gang").Orientation(SchedulerGroupOrientation.Vertical))
                    .Resources(resource =>
                    {
                        resource.Add(m => m.Gang)
                            .Title("Gang")
                            .Name("Gang")
                            .DataSource(ds => ds
                                .Custom()
                                .Transport(transport => transport.Read(read => read.Action("GetGangsForSchemePlanning", "Planning")/*.Data("getGangsForAppts")*/))
                                .Schema(s => s
                                    .Data("Data")
                                    .Total("Total")
                                    .Model(m =>
                                    {
                                        m.Id("ID");
                                        m.Field("Name", typeof(string));
                                    })))
                        .Multiple(true)
                        .DataValueField("ID")
                        .DataTextField("Name");
                    })
                    .EventTemplateId("eventTemplate")
            )

 

Any help would be appreciated as it is driving us mad!

 

Thanks

 

Michael
Top achievements
Rank 1
 asked on 26 Nov 2021
1 answer
136 views

HI I am using asp.net mvc .net (not core).  I have a grid which has paging . Pagig size is 20.  Now lets say I have functionality for download excel file and pdf file.  When user click on the download I want to download all the data not just what user see on the particular page. 

 

Thanks

 

Ivan Danchev
Telerik team
 answered on 26 Nov 2021
1 answer
117 views

I'm trying to create a 3 level hierarchy grid, but for some reason the second level doesn't show the expand button.

The only reason the 3rd level is expanded in the pic is because of the dataBound script, which expands everything.

How do I make the second level expandable?

Here's the code:


@(Html.Kendo().Grid(Model.SalaryApprovalEmployments) .Name("grid") .Columns(columns => { columns.Bound(e => e.Id).Width(100); columns.Bound(e => e.TotalCost).Width(100); columns.Bound(e => e.Trend).Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(sae => sae.Id); }) .ServerOperation(false) ) .Events(events => events.DataBound("dataBound")) .ClientDetailTemplateId("salaryCodeTemplate") .HtmlAttributes(new { style = "width:600px;" }) ) <script id="salaryCodeTemplate" type="text/kendo-tmpl"> @(Html.Kendo().Grid<SalaryApprovalTransactionDTO>() .Name("grid_#=Id#") .Columns(columns => { columns.Bound(o => o.SalaryApprovalEmploymentId).Width(100); columns.Bound(o => o.SalaryCodeId).Width(100); columns.Bound(o => o.Amount).Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(sat => sat.SalaryCodeId); }) .Read(read => read.Action("HierarchyBindingTransactions", "SalaryApproval", new { salaryApprovalGroupId = Model.Id, salaryApprovalEmploymentId = "#=Id#" })) ) .Events(events => events.DataBound("dataBound")) .ClientDetailTemplateId("transactionTemplate") .ToClientTemplate() ) </script> <script id="transactionTemplate" type="text/kendo-tmpl"> @(Html.Kendo().Grid<SalaryApprovalTransactionDTO>() .Name("grid_#=SalaryApprovalEmploymentId#_#=SalaryCodeId#") .Columns(columns => { columns.Bound(o => o.SalaryCodeId).Width(100); columns.Bound(o => o.UnitPrice).Width(100); columns.Bound(o => o.Hours).Width(100); columns.Bound(o => o.Days); columns.Bound(o => o.Amount).Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(sat => sat.Id); }) .Read(read => read.Action("HierarchyBindingTransactions", "SalaryApproval", new { salaryApprovalGroupId = Model.Id, salaryApprovalEmploymentId = "#=SalaryApprovalEmploymentId#", salaryCodeId = "#=SalaryCodeId#" })) ) .ToClientTemplate() ) </script> <script> function dataBound() { var grid = this; this.tbody.find("tr.k-master-row").each(function( index ) { grid.expandRow(this); }); } </script>

Martin
Top achievements
Rank 1
Iron
 answered on 26 Nov 2021
1 answer
1.2K+ views
HI Using asp.net mvc .net (not core).  I want to disable columns for edit. Person can read it but cannot overrite it.  How I can do that?
Yanislav
Telerik team
 answered on 26 Nov 2021
1 answer
159 views
HI I am using asp.net mvc .net (not core). Creating the grid.  The grid has multiple columns I only want to have sorting in 2 columns.  HOw I can do that?
Yanislav
Telerik team
 answered on 26 Nov 2021
4 answers
1.1K+ views
Adding tooltip to spreadsheet cell and also provide custom tooltip 
G.K. Raju
Top achievements
Rank 1
Iron
 answered on 25 Nov 2021
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
Licensing
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
+? 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?