Telerik Forums
UI for ASP.NET MVC Forum
16 answers
2.2K+ views
Hey,

I have a grid in master/detail like below.

CourseVM has an "Id" property as primary key (int)

As you can see, the detail grid uses a popup editor (custom editortemplate defined in /shared/EditorTemplates/CourseEntryVM.cshtml).

On that custom popup editor template, I need to have access to the master id (from CourseVM) in order to do some filtering for a dropdownlist, but I don't know how to have that Id.

Can anyone help me ?

Thanks

@(Html.Kendo().Grid<CourseVM>()
    .Name("CourseGrid")
    .DataSource(ds => ds
        .Ajax()
        .Events(events => events.Error("courseGridError"))
        .Model(model => model.Id(o => o.Id))
        .Read(read => read.Action("Course_Read", "Course"))
        .Destroy(destroy => destroy.Action("Course_Destroy", "Course"))
        .ServerOperation(false)
)
    .Columns(columns =>
    {
        columns.Bound(c => c.Id).Hidden();
        columns.Bound(c => c.Number);
        columns.Bound(c => c.OrganisationDisplay);
        columns.Bound(c => c.BeginDate);
        columns.Bound(c => c.EndDate);
        columns.Command(commands =>
        {
            commands.Custom("Aanpassen").Click("courseEdit");
            commands.Destroy().Text("Verwijderen");
        }).Title("Commands").Width(200);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Custom().Text("Nieuwe cursus inrichten").Action("Create", "Course");
    })
    .Pageable()
    .Sortable()
    .ClientDetailTemplateId("courseDetailTemplate")
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
    )
 
    <script id="courseDetailTemplate" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=Id#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Inschrijvingen").Content(
                    @<text>
                        @(Html.Kendo().Grid<CourseEntryVM>()
                                .Name("entryGrid_#=Id#")
                                .Columns(columns =>
                                {
                                    columns.Bound(c => c.StudentDisplay);
                                    columns.Bound(c => c.EntryDate);
                                  })
                                  .DataSource(dataSource => dataSource
                                      .Ajax()
                                      .Model(model =>
                                      {
                                          model.Id(c => c.StudentPersonAccountId);
                                      })
                                      .PageSize(30)
                                      .Read(read => read.Action("Entry_Read", "Course", new { courseId = "#=Id#" }))
                                      .Create(create => create.Action("Entry_Create", "Course", new { courseId = "#=Id#" }))
                                      .ServerOperation(false)
                                  )
                                  .ToolBar(toolbar =>
                                  {
                                      toolbar.Create().Text("Inschrijving toevoegen");
                                  })
                                  .Editable(editable => editable.Mode(GridEditMode.PopUp))
                                  .Pageable()
                                  .Sortable()
                                  .Events(events => events.Save("entryGridSaving"))
                                  .ToClientTemplate())
                    </text>
                    );
            })
                                    .ToClientTemplate()
        )
    </script>
Stefan
Telerik team
 answered on 22 May 2018
2 answers
90 views

Hi,

The snippet in the dojo link below works fine in Chrome.

In firefox the input field vanishes.  I think this has something to do with the float of the two panes, I need this as it is part of the site design.

http://dojo.telerik.com/OGazIYiQ/2

 

Can anyone help?

 

 

Thanks.

Preslav
Telerik team
 answered on 21 May 2018
1 answer
12.4K+ views
Hi Team,

I'd like to know how the column headers in a grid may be hidden. The effect I wish to achieve is something like the following:

Instead of:

Order ID        Employee                Ship Address
10251            Janet Leverling        2, rue du Commerce
10252            Margaret Peacock    Boulevard Tirou, 255

I wish to make my grid look like:

10251             Janet Leverling         2, rue du Commerce
10252             Margaret Peacock     Boulevard Tirou, 255

Just the same thing, but without the headers. Please let me know how to achieve this.
Stefan
Telerik team
 answered on 21 May 2018
1 answer
1.3K+ views

I'm trying to create a custom number format for a bound column using MVC/Grid like you see in Excel where you have a positive;negative;zero formats  I keep getting errors this is what I've tried:

.ClientTemplate("#= kendo.toString(RegularTimeHours, '##,##0.00;(##,##0.00);-' ) #")

.ClientTemplate("#= kendo.toString(RegularTimeHours, '{0:##,##0.00;(##,##0.00);-}' ) #")

 

Could I get some direction on how to do this?

Thanks

Lee

Stefan
Telerik team
 answered on 21 May 2018
2 answers
2.1K+ views

The MultiSelect-control is bound to a list of strings and it's required that the user select exactly four items.

How can I validate that with Kendo Validator or ASP.Net Validation?

I have also tried to use the Required annotation on the model property, but only that doesn't work.
Neither do the Range-keyword since it only works for numeric fields.

 

Johan
Top achievements
Rank 1
 answered on 19 May 2018
3 answers
589 views

HI I have asp.net mvc application with below telerik grid whcih i want to bind with asp.net webapi hosted on IIS. i can't find any ecample where to put the webapi url and how weapi's controller is invoked. please help in responding to this

 

 @(Html.Kendo().Grid<TelerikMvcApp131.Models.DeviceDetailsChild>()
                        .Name("webapi_grid")
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.person).Title("ID").Width(100);
                         
                            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                        })
                        .ToolBar(tools =>
                        {
                            tools.Create();
                        })
                        .Sortable()
                        .Pageable()
                        .Filterable()
                        .DataSource(dataSource =>
                            dataSource
                            .WebApi()
                            .Model(model =>
                            {
                                model.Id(p => p.Network);
                            })
                            .Events(events => events.Error("error_handler"))
                            .Read(read => read.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "product" })))
                     
                        )
                    )

 

Where should i define DefaultApi inside asp.net mvc application (note DefaultApi is defined inside webapi already)

Boyan Dimitrov
Telerik team
 answered on 18 May 2018
1 answer
604 views

So I pass in a model list of objects into my view, I reference this in my foreign key column and use filterable.UI to link to a separate function to control the filter. But when I try to do this the grid ignore my .Filterable options and uses the data from my Model.List to populate the filter, this is not the case with a non-foreign key column.

Does anyone know how to use custom filter options with a foreign key column in a kendo grid?

Tsvetina
Telerik team
 answered on 17 May 2018
1 answer
136 views

Using MVC; How do I get the labels (months)  to dynamically align at the bottom of the chart (see attached image) when values are negative?

I have tried:

.Labels(labels => labels.Padding(80, 0, 0, 0))

but it changes the scale of my chart if there are no negative values.

Stefan
Telerik team
 answered on 17 May 2018
1 answer
98 views
How does an MVC grid, or it's datasource determine which controller methods to use when Creating, reading, updating and destroying data utilizing the datasource.sync() method?  I have a grid that that when sync is called, it is trying to use the update method on a new record which causes an error.  I can't figure out how to identify the new record to the grid and datasource so that it will use the create method instead.  Has anyone else experienced this issue?
Casey
Top achievements
Rank 1
 answered on 16 May 2018
3 answers
548 views
Hello I want to export pivot grid with expanded rows and columns to excel/ pdf. The current demo does not reflect this.
Viktor Tachev
Telerik team
 answered on 15 May 2018
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
Rob
Top achievements
Rank 3
Bronze
Bronze
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
Bronze
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?