Telerik Forums
UI for ASP.NET MVC Forum
4 answers
290 views

Working on integrating a Kendo.DropDownList() into a Kendo.Filter object.

It currently works in everyway, other than actually supplying the selected value from the DDL into the datasource / grid binding.

How do I map the Value selected in the Filter Editor Template to the datasource / grid binding. I just need to pass the selected words to be used in the code behind query.

Current Implementation (DDL):

@(Html.Kendo().Filter<KitValidationDtoModel>()
    .Name("filter")
    .ApplyButton()
    .ExpressionPreview()
    .MainLogic(FilterCompositionLogicalOperator.And)
    .Fields(f =>
    {
        f.Add(p => p.OrderId).Label("Davidson Order ID");
        f.Add(p => p.EdiOrderId).Label("EDI Order ID");
        f.Add(p => p.Rfid).Label("RFID Tracker");
        f.Add(p => p.Assy).Label("ASSY");
        f.Add(p => p.Control).Label("Control Point").EditorTemplateId("controlTemplate");
        f.Add(p => p.Ei).Label("End Item");
        f.Add(p => p.Ship).Label("Ship");
    })
    .FilterExpression(f =>
    {
        f.Add(p => p.Control).IsEqualTo("");
        f.Add(p => p.Ship).Contains("");
    })
    .DataSource("dataSource1"))

 

<script type="text/x-kendo-template" id="controlTemplate">
    @(Html.Kendo().DropDownList()
                  .Name("control_filter_dll")
                  .OptionLabel("Select Control Point...")
                  .DataTextField("Control")
                  .DataValueField("Control")
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("GetControlPoints", "CustomOrder");
            });
        }).Events(e => e.Change("onControlChange")).ToClientTemplate())
</script>

Headygains
Top achievements
Rank 1
Veteran
 answered on 29 Jan 2021
2 answers
1.1K+ views

 

Hello,

My MVC project used Kendo Grid with pagination functionality.  How to set width of pagesize dropdown list without impacting other kendo dropdown list in the same page?  Thanks.

 

Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 29 Jan 2021
2 answers
1.3K+ views

When I call the Create method of kendo grid its giving an exception - ''"An item with the same key has already been added". I checked that their is no any duplicate property name in the model, Only one grid on the page. Not sure what causing this error. Appreciate your help in advance.

Inner Exception : 

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)<br>   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)<br>   at System.Collections.Generic.CollectionExtensions.ToDictionaryFast[TKey,TValue](TValue[] array, Func`2 keySelector, IEqualityComparer`1 comparer)<br>   at System.Web.Mvc.ModelBindingContext.get_PropertyMetadata()<br>   at System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor)<br>   at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext)<br>   at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model)<br>   at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<br>   at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)<br>   at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)<br>   at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)<br>   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__0(AsyncCallback asyncCallback, Object asyncState)

 

 

Grid : 

@(Html.Kendo().Grid<PersonViewModel>(false)

                            .HtmlAttributes(new { @style = "height: 100%;" })
                            .Name("ContactGrid")
                            .ToolBar(toolbar => toolbar.Create())
                            .toolbar(tools =>
                            {
                                tools.custom().name("addnewcontact").text("add new contact".translate()).htmlattributes(new
                                {
                                    id = "addnewcontact"
                                });
                            })
                            .Excel(e => { e.Filterable(true); e.AllPages(true); e.ForceProxy(true); e.ProxyURL("/Localized/" + nameof(LocalizedController.ExportToExcel)); })
                            .Editable(e =>
                            {
                                e.Enabled(true)
                                .DisplayDeleteConfirmation(true)
                               .Mode(GridEditMode.PopUp).TemplateName("PersonEditor")
                                .Window(w =>
                                {
                                    w.Scrollable(true)
                                    .Resizable()
                                    .Height(245).Width(400);
                                });
                            })

                    .DataSource(datasource => datasource
                    .Custom()
                    .Type("aspnetmvc-ajax")
                    .Transport(t =>
                    {
                        t.Read(r => r.Action("Contacts_Read", "DynamicDiscountingOffer").Data("getAdditionalData").Type(HttpVerbs.Get));
                        t.Create(c => c.Action("Contacts_Create", "DynamicDiscountingOffer").Data("getAdditionalDataToCreateContact"));
                        t.Create(c => c.Action("Contacts_Create", "DynamicDiscountingOffer"));
                    })

                    .Schema(s => s
                    .Model(model =>
                    {
                        model.Id(p => p.VR_PersonId);
                        model.Field(nameof(PersonViewModel.VR_Id), typeof(int?)).DefaultValue(VrId);
                        model.Field(nameof(PersonViewModel.FirstName), typeof(string));
                        model.Field(nameof(PersonViewModel.LastName), typeof(string));
                        model.Field(nameof(PersonViewModel.Email), typeof(string));
                    })
                    .Errors("Errors")
                    .Data("Data")
                    .Total("Total")
                    )
                    .PageSize(10)
                    .ServerSorting(true)
                    .ServerPaging(true)
                    .ServerFiltering(true)
                    .ServerGrouping(false)
                    .ServerAggregates(false)
                    .Events(events => events.Error("error_handler"))
                   )
                   .Pageable(p => { p.Refresh(true); p.PageSizes(new int[] { 10, 20, 50, 100, 200, 2000, 5000 }); })
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.FirstName).Width(140);
                        columns.Bound(c => c.LastName).Width(190);
                        columns.Bound(c => c.Email).Width(250);
                        columns.Command(command =>
                        {
                            ///command.Edit().UpdateText("Submit".Translate()).Visible("editVisible").Text("Edit".Translate());
                            command.Custom("View").Visible("viewVisible").Text("View".Translate()).Click("showDetails");
                            command.Custom("Delete").Visible("deleteVisible").Text("Delete".Translate()).Click("DeleteRow");
                        }).Width(85).MinResizableWidth(85);

                    }
    )
    )

 
[DataContract]
    [Serializable]
    public class PersonViewModel : IValidatableObject
    {
        public int VR_PersonId { get; set; }
 
        [DataMember]
        public int VR_Id { get; set; }
 
        [DataMember]
        public string VendorId { get; set; }
 
        [DataMember]
        public Nullable<Guid> UserId { get; set; }
         
        [DataMember]
        public Nullable<System.DateTime> StartDate { get; set; }

}

 

Anton Mironov
Telerik team
 answered on 29 Jan 2021
2 answers
187 views
I would like my users to be able to renamed or delete files, but not folders. I found the post asking how to prevent subfolders from being created, but delete and renaming seem to be different animals.
Responsive
Top achievements
Rank 1
Veteran
 answered on 28 Jan 2021
1 answer
858 views

Does the ExpansionPanel allow for nested objects within individual panels?

Will it handle the Telerik Grid or Tabs (with even more nesting)?

Is there any change required to make the nested items responsive?

Can the content be loaded using ajax (independently per panel)?

Georgi
Telerik team
 answered on 28 Jan 2021
1 answer
120 views

Hello,

 

I'm trying to show difference between columns on Kendo chart. I made a js function and I have found solution for Kendo UI, I'm trying to rewrite it to Kendo MVC but some issue - with calling js method - occured and don't have idea how can I resolve it.

 

Part of the code:

.Series(series => series.Column(column => column.NewUsers)
    .Name("New users")
    .Color("#007DC5")
    //.Visual("testFunc"))                                       <- it's working
    .Notes(n => n.Visual("testFunc")))                  <- it doesn't

 

so for now the commented line is working, but I've got my values instead of columns. I think the last line should work, because if I understood it well Notes means additional info (and it won't replace with columns), but it doesn't even enter to my method.

My function in js is:

function testFunc(e) { (...) }

 

I tried to do it with something like:

.Notes(n => n.Visual("testFunc()"))

.Notes(n => n.Visual("testFunc(this)"))

 

but in first case 'e' is undefined and in the second case this parameter is not the same as parameter in line which is working (//Visual("testFunc")), so I can't get my data to handle logic.

George Gindev
Telerik team
 answered on 26 Jan 2021
4 answers
886 views

Hi ,

i want to merge cells in grid client footer template to display text.

below css am used but still no use.

    .k-footer-template td:nth-child(1) {
        overflow: visible;
        white-space: nowrap;
    }

    .k-footer-template td:nth-child(1),
    .k-footer-template td:nth-child(2),
    .k-footer-template td:nth-child(3),
    .k-footer-template td:nth-child(4),
    .k-footer-template td:nth-child(5),
    .k-footer-template td:nth-child(6) {
        border-width: 0;
    }

Nikolay
Telerik team
 answered on 26 Jan 2021
4 answers
1.0K+ views

I needed to create a wizard and I started but using this sample: https://www.telerik.com/blogs/step-wise-forms-with-asp-net-mvc-and-kendo-ui

The two differences for my solution are that I need to use a different model and partial view for each tab and I don't want to load the tab until it is active.

The idea is that on tab 1 I gather some information, submit it, and then get the data and display tab 2...and so on...I can't seem to figure it out.

Each tab should have it's own partial view populated by it's own model by calling a controller action when the tab is activated.

Aleksandar
Telerik team
 answered on 26 Jan 2021
1 answer
1.8K+ views

Hi!

I've been trying to do this for less than a week but no luck so far.

I'm doing server-side pagination and try to load as many rows as needed to be shown on a grid page (based on pageSize and pageNumber). So far so good. But the problem is, the kendo grid assumes that the total number of row is the number of records my SP returns (which would be 10 if the page size is set to 10), and the only number it shows for the page number is '1'. I assume if I could set the total number of rows to the number of records I have (for example 100), then the grid will show the other pages. Is it even possible with kendo grids?

Thank you in advance.

Martin
Telerik team
 answered on 22 Jan 2021
6 answers
3.9K+ views

I'm able to format the dates the way I want in the grid, but they don't appear that way in my Excel export.

The code in my controller is:

1.[HttpPost]
2.public ActionResult Excel_Export_Save(string contentType, string base64, string fileName)
3.{
4.      var fileContents = Convert.FromBase64String(base64);
5.      return File(fileContents, contentType, fileName);
6.}

 

In my grid code below, lines 11 and 15 are the date fields in question.  They appear in the grid as MM/dd/yy hh:mm tt, but in the export they appear as MM/dd/yyyy.

01.@(Html.Kendo().Grid<ErmhsL2BudReqRawDto>()
02.    .Name("Grid")
03.    .Columns(columns =>
04.    {
05.        columns.Bound(c => c.Id).Hidden();
06.        columns.Bound(c => c.CharterId).Hidden();
07.        columns.Bound(c => c.CharterName).Width(400).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").SuggestionOperator(FilterType.Contains))).Locked(true);
08.        columns.Bound(c => c.EdcoeId).Width(100).Locked(true);
09.        columns.Bound(c => c.CdsCodeWithDashes).Locked(true).Width(150);
10.        columns.Bound(c => c.FiscalYear).Filterable(filterable => filterable.UI("fiscalYearFilter")).Locked(true).Width(100);
11.        columns.Bound(c => c.DateEntered).Format("{0:MM/dd/yy hh:mm tt}").HtmlAttributes(new { style = "text-align:right" }).Width(100);
12.        columns.Bound(c => c.ProgressMonitoringFrequency).Width(500);
13.        columns.Bound(c => c.MonitorNameAndTitle).Width(300);
14.        columns.Bound(c => c.IsAmhpCertified).Filterable(filterable => filterable.Messages(m => m.IsFalse("No")).Messages(m => m.IsTrue("Yes"))).ClientTemplate("#=IsAmhpCertified ? 'Yes': 'No'#").HtmlAttributes(new { style = "text-align:center" }).Width(100);
15.        columns.Bound(c => c.AmhpDateEntered).Format("{0:MM/dd/yy hh:mm tt}").HtmlAttributes(new { style = "text-align:right" }).Width(100);
16.    })
17.    .ToolBar(tools => tools.Excel())
18.    .Excel(excel => excel
19.        .AllPages(true)
20.        .FileName("ERMHS Level 2 Budget Requests.xlsx")
21.        .Filterable(true)
22.        .ProxyURL(Url.Action("Excel_Export_Save", "FiscalReport"))
23.    )
24.    .Filterable(filterable => filterable
25.        .Extra(false)
26.        .Operators(operators => operators
27.            .ForString(str => str.Clear()
28.                .StartsWith("Starts with")
29.                .IsEqualTo("Is equal to")
30.                .IsNotEqualTo("Is not equal to")
31.        ))
32.    )
33.    .Groupable()
34.    .Pageable(m => m.PageSizes(new[] { "25", "50", "100", "All" }))
35.    .Resizable(resizable => resizable.Columns(true))
36.    .Sortable()
37.    .Scrollable(s => s.Enabled(true))
38.    .HtmlAttributes(new { style = "height:700px;" })
39.    .DataSource(dataSource => dataSource
40.        .Ajax()
41.        .PageSize(25)
42.        .Events(events => events.Error("error_handler"))
43.        .Model(model =>
44.        {
45.            model.Id(p => p.Id);
46.            model.Field(p => p.Id).Editable(false);
47.            model.Field(p => p.CharterId).Editable(false);
48.        })
49.        .Sort(sort =>
50.        {
51.            sort.Add(p => p.CharterName);
52.        })
53.        .Read(read => read.Action("ErmhsL2BudgetRequests_Read", "FiscalReport"))
54.    )
55.)

 

 

Simon
Top achievements
Rank 1
 answered on 21 Jan 2021
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
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?