Telerik Forums
UI for ASP.NET MVC Forum
1 answer
157 views
Hello Guys,

I have a grid with a start and end date and would like to select several start date cells and make an adjustment in the top selected start date cell and then all selected cells should be overwritten.

https://demos.telerik.com/aspnet-mvc/grid/selection

Thanks in advance!
Yanislav
Telerik team
 answered on 25 Jul 2022
0 answers
110 views

I have an existing dropdownlist which gets its data via ajax from api.

Now, I want to add an item "Add New" (just under the existing optionlabel) , which when clicked will open a kendo window.

Questions:

1. First of all, is there any easy/direct way to do this?

2. One option that I could think of - and I am trying to get that working - is to add an item after the initial ajax data is loaded, and use onSelect to check if the option selected is "Add New" and open a window

However, I am not able to implement this. I am stuck at trying to add an additional item to the existing options (which as I mentioned is retrieved via ajax). How to do this? Please note that I already have a optionlabel which I want to retain (based on clients insistence).

 

Any idea how to achieve this?

 

PS: i cannot add this from server side api as that code is not in my control.

 

Azhar
Top achievements
Rank 1
Iron
 asked on 22 Jul 2022
1 answer
1.1K+ views

We have a Kendo grid that can display anywhere from 10 to thousands of rows.  We want to be able to set the grid page size to several values, including ALL.

What we have now - without ALL works:

.Pageable(p => p
     .PageSizes(new[] { 100, 200, 500, 1000, 2000 })

When we run this - we see the correct values in the "Items per page" dropdown.

We want to add the "All" option to this dropdown, but the following is not working (compile error)
.Pageable(p => p
     .PageSizes(new[] { 100, 200, 500, 1000, 2000, "All" })

How do we include All along with other values in the Items per page?

 

Eyup
Telerik team
 answered on 20 Jul 2022
26 answers
1.0K+ views
Hi Guys!

I'm curious why the Telerik upgrade project wizard is so very slow every time i upgrade an ASP.NET MVC 4 project. I can see each of the files copied in status bar with a what seems like a forced delay in between each file. The whole process takes more than 10+ minutes and in the meantime the drive activity is very low.
All other operations with 100 times more files on my SSD machine are very fast and finish in matters of seconds like it is with creating new Kendo UI ASP.NET MVC 4 project.
Just for the existing project the upgrade operation is very very slow and i wonder if you guys can shed some light on the matter.

Cheers!
Nikolay Mishev
Telerik team
 answered on 20 Jul 2022
1 answer
129 views

Hello,

I'm working on the KendoUI Sample Grid Application for MVC. 

This is my view file:

@using Kendo.Mvc.UI
@{
    ViewBag.Title = "Grid";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Grid</h2>

<div id="dependents">
    <div id="grid">
        @(Html.Kendo().Grid<KendoUIApp1.Models.OrderViewModel>()
              .Name("grid")
              .DataSource(dataSource => dataSource
                  .Ajax()
                  .Read(read => read.Action("Orders_Read", "Grid"))
                  .ServerOperation(false)
              )
              .Columns(columns =>
              {
                  columns.Bound(d => d.OrderID).Title("order_id");
                  columns.Bound(d => d.Freight).Title("Freight");
                  columns.Bound(d => d.OrderDate).Title("OrderDate");
                  columns.Bound(d => d.ShipName).Title("ShipName");
                  columns.Bound(d => d.ShipCity).Title("ShipCity");
              })
              .Pageable()
              .Sortable()
              .HtmlAttributes(new {style = "height: 400px;"})
              )
    </div>
</div>

And this is my GridController File

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using KendoUIApp1.Models;

namespace KendoUIApp1.Controllers
{
	public partial class GridController : Controller
    {
		public ActionResult Orders_Read()
		{
			var result = Enumerable.Range(0, 50).Select(i => new OrderViewModel
			{
				OrderID = i,
				Freight = i * 10,
				OrderDate = DateTime.Now.AddDays(i),
				ShipName = "ShipName " + i,
				ShipCity = "ShipCity " + i
			});

			return Json(result, JsonRequestBehavior.AllowGet);
		}

		public ActionResult View_Orders()
        {
			return View();
        }
	}
}

When I run the Application, The Grid isn't binding the columns with the JSON result. It's simply returning the JSON in a new page. What should I do? 

Thank you for your help!

Eyup
Telerik team
 answered on 18 Jul 2022
1 answer
300 views
Hi Team, 
Not Sure which recent update of the kendo library introduced this auto date time zone conversion in our project. After receiving UTC date from server, the kendo grid changes it to local time. Can you please help me with -

- Which version of kendo has this feature starting from?
- Is there any setting that we can set it off so that the grid shows exact the same datetime as provided from db?

Thanks,
Chhavi
Yanislav
Telerik team
 answered on 14 Jul 2022
1 answer
138 views

I have an ASP.NET MVC project and one of the project's pages has a grid that includes two columns called "Company" and "Segment". The Segment column is a foreign key column that is bound to a list of possible values to convert the underlying ID that's stored in the database into a user-friendly drop-down list of names to pick from.

The problem I'm having is that the contents of the Segment foreign key drop-down should be filtered according to the value of the Company column and not quite sure how to get this working. The rows are edited using the inline edit mode in case that makes any difference.

To try and make this a bit more concrete, this is what the data bound to the segment foreign key column could look like:

CompanyID    SegmentID  SegmentName

1                       1                   One

1                       2                   Two

2                      3                   Three

2                      4                   Four

 

So on editing a row, the Segment column drop-down currently shows all four values, but it should only show the two items that are associated with the related company ID.

I've looked at using a remote data source on the foreign key column to determine whether I can use the option of providing additional arguments via the `Data` option, but the data source is only queried once, when the grid is first loaded rather than on each cell edit.

I've also looked at the `beforeEdit` and `edit` events but `beforeEdit` is documented as being fired before cell editors are created and `edit` only gives me information about the row that's being edited.

The ability to define a custom editor looks more promising, but this is an MVC project and so the only option there appears to be a custom editor template and I don't know how I would extract values from other parts of the row to provide to any remote data source URL.

Thanks in advance for any help or suggestions.

 

Yanislav
Telerik team
 answered on 13 Jul 2022
0 answers
135 views

I'm using EditorTemple to populate dropdown while in edit mode. I have my editor template in the Views/Shared/EditorTemplates folder.

But when I press the Edit button it does nothing and shows a simple text box instead of a dropdown.

I'm using dynamic properties for binding instead of the view model, all the references I've looked at are based on the view model.

Is there any way to accomplish the same with dynamic property binding?

Here's my code of Grid:


@(Html.Kendo().Grid<object>()
                                        .Name("Grid")
                                        .AutoBind(true)
                                        //.Events(ev => ev.Filter("setGridFilters").DataBound("setAutoFitColumn"))
                                        .Columns(columns =>
                                        {
                                            columns.AutoGenerate(true);
                                            columns.Bound("status").Title("Lead Status").Width(100).EditorTemplateName("LeadStatusList")
                                            .Filterable(a=>a.Multi(true).Search(true).BindTo(new[] {
                                            new{
                                                status="None"
                                            },
                                            new{
                                                status="Initial Call Scheduled"
                                            },
                                            new{
                                                status="Working"
                                            },
                                            new{
                                                status="Nurturing"
                                            },
                                            new{
                                                status="Unqualified"
                                            },
                                            new{
                                                status="Qualified"
                                            }
                                            }));
                                            columns.Bound("ownerId").Title("Owner").Width(100).Filterable(a => a.Multi(true).Search(true).DataSource(ds => ds.Custom()

                                            .Type("aspnetmvc-ajax")
                                            .Transport(transport =>
                                            transport.Read(read => read.Action("", "", new { field = "ownerId" }))
                                            )
                                            .Schema(schema => schema
                                            .Data("names")
                                            )));
                                            columns.Bound("eventBookedC").ClientTemplate("<div   title='#= title #'>#:getEventStatus(eventBookedC) #</div>").Title("Event Booked").Width(70)
                                            .Filterable(a => a.Multi(true).Search(true).BindTo(new[] {
                                            new{
                                                eventBookedC="Null"
                                            },
                                            new{
                                                eventBookedC="True"
                                            },
                                            new{
                                                eventBookedC="False"
                                            }
                                            }));
                                            columns.Command(command => { command.Edit();}).Width(150);
                                        })
                                        .Editable(editable => editable.Mode(GridEditMode.InLine))
                                    .Sortable()
                                    .Filterable()
                                    .Scrollable(sc => sc.Endless(true))
                                    .Groupable()
                                    .Resizable(resize => resize.Columns(true))
                                    .Reorderable(reorder => reorder.Columns(true))

                                    .ToolBar(e =>
                                    {
                                        e.Search();
                                        e.Custom().Text("Create New").HtmlAttributes(new { id = "btnCreateNew", @class = "btn btn-primary" });
                                    })
                                    .Pageable(p => p.Numeric(false).PreviousNext(false).Refresh(true))
                                    .Events(events => events
                                    .Sort("onSorting")
                                    .Filter("onFiltering")
                                    .Group("onGrouping")
                                    .Page("onPaging")
                                    .GroupCollapse("onGroupCollapse")
                                    .GroupExpand("onGroupExpand")
                                    .DataBound("onDataBound")
                                    .ColumnReorder("onColumnReordering")
                                    .Edit("edit")
                                     )


                                     .DataSource(dataSource => dataSource
                                        .Custom()
                                         .Type("aspnetmvc-ajax")
                                         .PageSize(500)
                                         .ServerPaging(true)
                                         .ServerFiltering(true)
                                         .ServerSorting(true)
                                         .ServerGrouping(true)
                                         .Transport(transport =>
                                         {
                                             transport.Read(read => read.Action("", ""));
                                             transport.Update(update => update.Action("", ""));
                                         }
                                         )
                                         .Schema(schema => schema
                                         .Data("data")
                                         .Total("total")
                                         .Model(m=>m.Id("id"))
                                         )
                                         )

                                 )

Here's my editor template -> LeadStatusList.cshtml:


@using Kendo.Mvc.UI
@(Html.Kendo().DropDownList()
                               .Name("Status")
                              .DataTextField("Text")
                              .DataValueField("Value")
                              .BindTo(new List<SelectListItem>() {
                                  new SelectListItem() {
                                      Text = "None",
                                      Value = "None"
                                  },
                                  new SelectListItem() {
                                      Text = "Initial Call Scheduled",
                                      Value = "Initial Call Scheduled"
                                  },
                                  new SelectListItem() {
                                      Text = "Working",
                                      Value = "Working"
                                  },
                                   new SelectListItem() {
                                      Text = "Nurturing",
                                      Value = "Nurturing"
                                  },
                                    new SelectListItem() {
                                      Text = "Unqualified",
                                      Value = "Unqualified"
                                  },
                                    new SelectListItem() {
                                      Text = "Qualified",
                                      Value = "Qualified"
                                  }
                              })
                              .Value("1")
                              .HtmlAttributes(new { style = "width: 100%" })
                        )

Zack
Top achievements
Rank 1
 asked on 10 Jul 2022
0 answers
202 views

I'm using EditorTemple to populate dropdown while in edit mode. I have my editor template in the Views/Shared/EditorTemplates folder.

But when I press the Edit button it does nothing and shows a simple text box instead of a dropdown.

Here's my code of Grid:


@(Html.Kendo().Grid<object>()
                                        .Name("Grid")
                                        .AutoBind(true)
                                        //.Events(ev => ev.Filter("setGridFilters").DataBound("setAutoFitColumn"))
                                        .Columns(columns =>
                                        {
                                            columns.AutoGenerate(true);
                                            columns.Bound("status").Title("Lead Status").Width(100).EditorTemplateName("LeadStatusList")
                                            .Filterable(a=>a.Multi(true).Search(true).BindTo(new[] {
                                            new{
                                                status="None"
                                            },
                                            new{
                                                status="Initial Call Scheduled"
                                            },
                                            new{
                                                status="Working"
                                            },
                                            new{
                                                status="Nurturing"
                                            },
                                            new{
                                                status="Unqualified"
                                            },
                                            new{
                                                status="Qualified"
                                            }
                                            }));
                                            columns.Bound("ownerId").Title("Owner").Width(100).Filterable(a => a.Multi(true).Search(true).DataSource(ds => ds.Custom()

                                            .Type("aspnetmvc-ajax")
                                            .Transport(transport =>
                                            transport.Read(read => read.Action("", "", new { field = "ownerId" }))
                                            )
                                            .Schema(schema => schema
                                            .Data("names")
                                            )));
                                            columns.Bound("eventBookedC").ClientTemplate("<div   title='#= title #'>#:getEventStatus(eventBookedC) #</div>").Title("Event Booked").Width(70)
                                            .Filterable(a => a.Multi(true).Search(true).BindTo(new[] {
                                            new{
                                                eventBookedC="Null"
                                            },
                                            new{
                                                eventBookedC="True"
                                            },
                                            new{
                                                eventBookedC="False"
                                            }
                                            }));
                                            columns.Command(command => { command.Edit();}).Width(150);
                                        })
                                        .Editable(editable => editable.Mode(GridEditMode.InLine))
                                    .Sortable()
                                    .Filterable()
                                    .Scrollable(sc => sc.Endless(true))
                                    .Groupable()
                                    .Resizable(resize => resize.Columns(true))
                                    .Reorderable(reorder => reorder.Columns(true))

                                    .ToolBar(e =>
                                    {
                                        e.Search();
                                        e.Custom().Text("Create New").HtmlAttributes(new { id = "btnCreateNew", @class = "btn btn-primary" });
                                    })
                                    .Pageable(p => p.Numeric(false).PreviousNext(false).Refresh(true))
                                    .Events(events => events
                                    .Sort("onSorting")
                                    .Filter("onFiltering")
                                    .Group("onGrouping")
                                    .Page("onPaging")
                                    .GroupCollapse("onGroupCollapse")
                                    .GroupExpand("onGroupExpand")
                                    .DataBound("onDataBound")
                                    .ColumnReorder("onColumnReordering")
                                    .Edit("edit")
                                     )


                                     .DataSource(dataSource => dataSource
                                        .Custom()
                                         .Type("aspnetmvc-ajax")
                                         .PageSize(500)
                                         .ServerPaging(true)
                                         .ServerFiltering(true)
                                         .ServerSorting(true)
                                         .ServerGrouping(true)
                                         .Transport(transport =>
                                         {
                                             transport.Read(read => read.Action("", ""));
                                             transport.Update(update => update.Action("", ""));
                                         }
                                         )
                                         .Schema(schema => schema
                                         .Data("data")
                                         .Total("total")
                                         .Model(m=>m.Id("id"))
                                         )
                                         )

                                 )

 

Here's my editor template -> LeadStatusList.cshtml:


@using Kendo.Mvc.UI
@model AzranHawkins.Models.Lead
@(Html.Kendo().DropDownListFor(x => x.Status)
                              .DataTextField("Text")
                              .DataValueField("Value")
                              .BindTo(new List<SelectListItem>() {
                                  new SelectListItem() {
                                      Text = "None",
                                      Value = "None"
                                  },
                                  new SelectListItem() {
                                      Text = "Initial Call Scheduled",
                                      Value = "Initial Call Scheduled"
                                  },
                                  new SelectListItem() {
                                      Text = "Working",
                                      Value = "Working"
                                  },
                                   new SelectListItem() {
                                      Text = "Nurturing",
                                      Value = "Nurturing"
                                  },
                                    new SelectListItem() {
                                      Text = "Unqualified",
                                      Value = "Unqualified"
                                  },
                                    new SelectListItem() {
                                      Text = "Qualified",
                                      Value = "Qualified"
                                  }
                              })
                              .Value("1")
                              .HtmlAttributes(new { style = "width: 100%" })
                        )

 

I also tried

Html.Kendo().DropDownList().Name("Status") instead of Html.Kendo().DropDownListFor(x => x.Status)

Zack
Top achievements
Rank 1
 updated question on 09 Jul 2022
0 answers
138 views
My question might be somewhat loaded. In a viewpage called `CustomView.cshtml`, I have a grid that contains a toolbar holding a `DropDownList`. Right above the `DropDownList` is a  `TabStrip`. The `TabStrip` is a seperate `.cshtml` file and within it I'm loading `Items` that make a call to `LoadContentFrom(CustomView)`. For some reason, when I click the tab, the `DropDownList` appears as an input box and I can't figure out why this is happening.
Carlos
Top achievements
Rank 1
 asked on 08 Jul 2022
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
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
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?