Telerik Forums
UI for ASP.NET MVC Forum
9 answers
1.2K+ views
I have a Kendo Grid and a DropDown List that work well.  Thee is a field in one of the models (model:Products Field:Status),  What I want is if the Field Status = "discontinued" I need to not display that record in the grid or the dropdown. How would I go about doing that? 
Nikolay
Telerik team
 answered on 08 Jun 2020
9 answers
4.7K+ views

I have a popup edit screen that has a few dropdown list on it.  They work great until I do into a screen and add an item for that dropdown list and low and behold I go back to that edit screen I don't see the new item unless I exit out and go back in.  I have found dropdownlist.dataSource.read(); but I am not sure how to use that. Can someone tell me how to refresh the dropdown list please?  I would think that when I open the edit pop up screen it would do it but it does not.  I need to get an answer to this quickly.

Thanks

Christine
Top achievements
Rank 1
Veteran
 answered on 04 Jun 2020
10 answers
1.4K+ views
I need to save the expanded/collapsed state of Kendo UI Treelist so that nodes are expanded when I visit another page and come back.

It can be done for Treeview but not able to replicate the same. (http://jsfiddle.net/lhoeppner/rwfsf/)
Sivaramakrishna Reddy
Top achievements
Rank 1
Veteran
 answered on 03 Jun 2020
1 answer
464 views

Is there a form to put a 'label for' on a old version @(Html.Kendo().TextBox() 2015.1.429.545?

It has not the .label prop

 

Thanks

Sergio

 

Eyup
Telerik team
 answered on 03 Jun 2020
15 answers
5.0K+ views

How do you get the selected rows in the grid? I found some articles that explained on how to do this. But none of them worked (it seemed like things changed in the latest beta).This is my grid:

@(Html.Kendo().Grid(Model)
        //The grid will be bound to the Model which is the Products table     
.Name("dg") //The name of the grid is mandatory. It specifies the "id" attribute of the widget.     
.Columns(columns =>
    {       
        columns.Bound(dg => dg.Title);         
        columns.Bound(dg => dg.Version);
        columns.Bound(dg => dg.Created).Format("{0:d}");
        columns.Bound(dg => dg.CreatedBy);
        columns.Bound(dg => dg.Modified).Format("{0:d}");
        columns.Bound(dg => dg.ModifiedBy);
        columns.Bound(dg => dg.CheckedOutDateTime).Format("{0:d}");
    })
.Sortable()
.Pageable()
.Navigatable()
.Sortable()
.Filterable()
.Selectable(s => s.Mode(GridSelectionMode.Multiple))
.DataSource(dataSource => dataSource
        .Server()
        .Model(model => model.Id(dg => dg.DocumentGroupID)))
.Events(events => events.Change("dgChange"))       
)

<script>
    function dgChange()
    {
 // What should I put here to get the ID of the selected rows?
       
    }
</script>

Petar
Telerik team
 answered on 02 Jun 2020
2 answers
9.1K+ views
I'm testing out some conversion of MVC grid to Kendo grid, and i'm running into several issues with template columns.  Am I doing something wrong here?

In some scenarios, I get "undefined" showing in the column, others I'm getting a javascript error "cannot call kendoSortable
on undefined".  I assume they're both the same issue related to the rendering of the column.


@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
                 {
                     columns.Template(o => Html.ActionLink(o.ProductID.ToString(), "Index", "Home"));
                     
                     columns.Bound(p => p.ProductName);
                     columns.Bound(p => p.UnitPrice);
                     columns.Bound(p => p.UnitsInStock);
                 })
    .Groupable()
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "Grid"))
    )
)

Thanks!
Jason
yongkai
Top achievements
Rank 1
 answered on 02 Jun 2020
11 answers
2.0K+ views
Hi,
The lastest release version (2015.2.624) add a useful feature that display 'all' option in pager.
But I didn't find it in ASP.NET MVC Wrapper function.
I try insert '0' pagesize and it seems as same as 'all' option.

.Pageable(pager => pager.PageSizes(new int[] { 5, 10, 20, 0 }))

But it displayed '0' in pager and I didn't find the method that change the 'all' message by MVC Wrapper.
It seems not exist in pager.Messages.

Can someone advise me, please?
Petar
Telerik team
 answered on 01 Jun 2020
1 answer
165 views

Hi All

I just want to learn when i do custom excel export i want to get filtered data from ajax request

I tried .view() but it just return data on screen like if i have 20 data and show just 10 of them i get just 10 of them

on the other hand i tried .data() function but that is returning all data and i have really huge data like 15k data

 

How to get just filtered data?

 

here my grid and js functon and controller

@( Html.Kendo().Grid<Orpac.Controllers.DashboardsController.ATGAlerts>()
                 .Name("grdProductAlert").AutoBind(false)
                 .HtmlAttributes("width: 100%;cellpadding:0;")
                 .DataSource(d => d.Ajax().Read(r => r.Action("GridProductAlertBinding", "Dashboards").Type(HttpVerbs.Get)).ServerOperation(false))
                  .Columns(columns =>
                  {
                      columns.Bound(e => e.BelIdent).Title("Id").Width("auto");
                      columns.Bound(e => e.StationCode).Title("Station Code").Width("auto");
                      columns.Bound(e => e.StationName).Title("Station Name").Width("auto");
                      columns.Bound(e => e.BelTarih).Title("Date Time").ClientTemplate("#= kendo.toString(BelTarih, 'MM/dd/yyyy') #").ClientGroupHeaderTemplate("DateTime" + ": #=  kendo.toString(value, 'MM/dd/yyyy') #").Width("auto");
                      columns.Bound(e => e.BelInsTime).Title("Alert Time").ClientTemplate("#= kendo.toString(BelInsTime, 'MM/dd/yyyy HH:mm tt') #").ClientGroupHeaderTemplate("DateTime" + ": #=  kendo.toString(value, 'MM/dd/yyyy HH:mm tt') #").Width("auto");
                      columns.Bound(e => e.ProductCode).Title("Product Code").Width("auto");
                      columns.Bound(e => e.BelAlarm).Title("Alarm").Width("auto");
                      columns.Bound(e => e.BelLevelPerc).Title("Level %").Width("auto");
                      columns.Bound(e => e.BelTotCapacity).Title("Total Capacity").Width("auto");
                      columns.Bound(e => e.BelFuelVolume).Title("Available Volume").Width("auto");
                  }
                )
                .ToolBar(toolBar =>
                {
                    toolBar.Custom().Text(" ").HtmlAttributes(new { @class = "btnexcel", href = "#", onclick= "testexcel()" });
                    toolBar.Custom().Text((string)ViewData["ClearFilter"]).HtmlAttributes(new { @class = "k-button", id = "cleargrid", href = "#", onclick = "clearFiltersFuelLevel()" });
                }
                )
                .Selectable()
                .Sortable()
                .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(5))
                .Filterable(filterable => filterable
                .Extra(false)
                .Operators(operators => operators
                .ForString(str => str.Clear()
                .StartsWith((string)ViewData["Startswith"])
                .Contains((string)ViewData["Contains"])
                ))
                )
                .Groupable()
                .Scrollable(scrolling => scrolling.Height("100%"))
                .Resizable(config =>
                {
                    config.Columns(true);
                })
                .Reorderable(config =>
                {
                    config.Columns(true);
                })
                .ColumnMenu()
                )

here my js

function testexcel() {
    var grid = $("#grdProductAlert").data('kendoGrid');
 
    var viewdata = {
        data: grid.dataSource.view()
    };
 
 
 
    var url = '../Dashboards/ExportCsvList';
    $.ajax({
        type: "POST",
        url: url,
        traditional:true,
        data: { request: viewdata.data },
        success: function (msg) {
             
        }
    });
}

 

here my conroller

public FileResult ExportCsvList(List<ATGAlerts> request)
        {
            //Get the data representing the current grid state - page, sort and filter
            var products = request;
 
            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
            {
                /* Create the worksheet. */
 
                SpreadsheetDocument spreadsheet = Excel.CreateWorkbook(stream);
                Excel.AddBasicStyles(spreadsheet);
                Excel.AddAdditionalStyles(spreadsheet);
                Excel.AddWorksheet(spreadsheet, "ProductAlert");
                Worksheet worksheet = spreadsheet.WorkbookPart.WorksheetParts.First().Worksheet;
 
                //create columns and set their widths
 
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 1, "Ident", false, false);
                Excel.SetColumnWidth(worksheet, 1, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 2, "Station Code", false, false);
                Excel.SetColumnWidth(worksheet, 2, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 3, "Station  Name", false, false);
                Excel.SetColumnWidth(worksheet, 3, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 4, "Date Time", false, false);
                Excel.SetColumnWidth(worksheet, 4, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 5, "Alert Time", false, false);
                Excel.SetColumnWidth(worksheet, 5, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 6, "Product Code", false, false);
                Excel.SetColumnWidth(worksheet, 6, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 7, "Alarm", false, false);
                Excel.SetColumnWidth(worksheet, 7, 50);
 
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 8, "Level %", false, false);
                Excel.SetColumnWidth(worksheet, 8, 50);
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 9, "Total Capacity", false, false);
                Excel.SetColumnWidth(worksheet, 9, 50);
 
 
                Excel.SetColumnHeadingValue(spreadsheet, worksheet, 10, "Available Volume", false, false);
                Excel.SetColumnWidth(worksheet, 10, 50);
 
                /* Add the data to the worksheet. */
 
                // For each row of data...
                for (int idx = 0; idx < products.Count; idx++)
                {
                    // Set the field values in the spreadsheet for the current row.
                    Excel.SetCellValue(spreadsheet, worksheet, 1, (uint)idx + 2, products[idx].BelIdent.ToString(), false, false);
 
                    Excel.SetCellValue(spreadsheet, worksheet, 2, (uint)idx + 2, products[idx].StationCode, false, false);
 
                    Excel.SetCellValue(spreadsheet, worksheet, 3, (uint)idx + 2, products[idx].StationName, false, false);
                    Excel.SetCellValue(spreadsheet, worksheet, 4, (uint)idx + 2, products[idx].BelTarih.Value, 1, false);
                    Excel.SetCellValue(spreadsheet, worksheet, 5, (uint)idx + 2, products[idx].BelInsTime.Value, 1, false);
                    Excel.SetCellValue(spreadsheet, worksheet, 6, (uint)idx + 2, products[idx].ProductCode, false, false);
 
                    Excel.SetCellValue(spreadsheet, worksheet, 7, (uint)idx + 2, products[idx].BelAlarm, false, false);
 
                    Excel.SetCellValue(spreadsheet, worksheet, 8, (uint)idx + 2, products[idx].BelLevelPerc.ToString(), false, false);
 
                    Excel.SetCellValue(spreadsheet, worksheet, 9, (uint)idx + 2, products[idx].BelTotCapacity.ToString(), false, false);
                    Excel.SetCellValue(spreadsheet, worksheet, 10, (uint)idx + 2, products[idx].BelFuelVolume.ToString(), false, false);
 
                }
 
                /* Save the worksheet and store it in Session using the spreadsheet title. */
 
                worksheet.Save();
                spreadsheet.Close();
 
                return File(stream.ToArray(),   //The binary data of the XLS file
                "application/vnd.ms-excel", //MIME type of Excel files
                "ProductAlert.xlsx");
            }
        }

 

please help

Nikolay
Telerik team
 answered on 01 Jun 2020
1 answer
2.1K+ views

  Hi All

Is it possible to send Kendo Grid DataSourceRequest as javascript parameter to conroller?

 

I just want to do something like this

var url = '../Dashboards/ExportCsvList';
$.ajax({
    type: "POST",
    url: url,
    traditional:true,
    data: { request: datarequest} // i want to send as paramter
    success: function (msg) {
         
    }
});

and i want to catch that as in example below

public FileResult ExportCsvList([DataSourceRequest]DataSourceRequest request)
{
           //do smth...
}

 

Is it possible?

 

Thanks

Alex Hajigeorgieva
Telerik team
 answered on 01 Jun 2020
1 answer
1.4K+ views

Hi All,

 

I'm using kendo mvc grid and sometimes i have 15k data or 100k data and sometimes i need to export excel them with 5k data and using your export excel function but it creates problem to me

Is there any limitation for row value? How can i handle this? 

I want to export excel all my grids from toolbar actions... How can you help me?

Here is my grid..

@(Html.Kendo().Grid<ATGAlerts>()
                    .Name("grdWaterAlert").AutoBind(false)
                    .HtmlAttributes("width: 100%;cellpadding:0;")
                    .DataSource(d => d.Ajax().Read("GridWaterAlertBinding", "Dashboards"))
                    .Columns(columns =>
                    {
                        columns.Bound(e => e.BelIdent).Title("Id").Width("auto");
                        columns.Bound(e => e.StationCode).Title("Station Code").Width("auto");
                        columns.Bound(e => e.StationName).Title("Station Name").Width("auto");
                        columns.Bound(e => e.BelTarih).Title("DateTime").ClientTemplate("#= kendo.toString(BelTarih, 'MM/dd/yyyy') #").ClientGroupHeaderTemplate("DateTime" + ": #=  kendo.toString(value, 'MM/dd/yyyy') #").Width("auto");
                        columns.Bound(e => e.BelInsTime).Title("Alert Time").ClientTemplate("#= kendo.toString(BelInsTime, 'MM/dd/yyyy HH:mm tt') #").ClientGroupHeaderTemplate("DateTime" + ": #=  kendo.toString(value, 'MM/dd/yyyy HH:mm tt') #").Width("auto");
                        columns.Bound(e => e.BelTankId).Title("Tank ID").Width("auto");
                        columns.Bound(e => e.ProductCode).Title("Product Code").Width("auto");
                        columns.Bound(e => e.BelAlarm).Title("Alarm").Width("auto");
                        columns.Bound(e => e.BelTotCapacity).Title("Total Capacity").Width("auto");
                        columns.Bound(e => e.BelWaterVol).Title("Water Volume").Width("auto");
                    })
                    .ToolBar(toolBar =>
                    {
                        toolBar.Excel().HtmlAttributes(new { @class = "btnexcel" }).Text(" ").IconClass("k-i-excel");
                        toolBar.Custom().Text((string)ViewData["ClearFilter"]).HtmlAttributes(new { @class = "k-button", id = "cleargrid", href = "#", onclick = "clearFiltersWaterLevel()" });
                    })
                    .Excel(excel => excel.FileName("WaterAlert.xlsx").Filterable(true))
                    .Selectable()
                    .Sortable()
                    .Pageable(pageable => pageable
                    .Refresh(true)
                    .PageSizes(true)
                    .ButtonCount(5))
                    .Filterable(filterable => filterable
                    .Extra(false)
                    .Operators(operators => operators
                    .ForString(str => str.Clear()
                    .StartsWith((string)ViewData["Startswith"])
                    .Contains((string)ViewData["Contains"])
                    ))
                    )
                    .Groupable()
                    .Scrollable(scrolling => scrolling.Height("100%"))
                    .Resizable(config =>
                    {
                    config.Columns(true);
                    })
                    .Reorderable(config =>
                    {
                    config.Columns(true);
                    })
                    .ColumnMenu()
                )

 

 

 

Thanks for help!

Nikolay
Telerik team
 answered on 01 Jun 2020
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
DropDownButton
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
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
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?