Telerik Forums
UI for ASP.NET MVC Forum
3 answers
193 views

Hi

I am trying to put together a master/detail grid where both the master and detail grid has foreign key columns. The two grids work normally with the foreign key columns when they are on their own, but once I put them together, I have an "invalid template" error.

Here's my razor view of the master/detail grid.

    @(Html.Kendo().Grid<EMD.DAL.Domain.Attribute.AssetSubType>()
      .Name("subTypeGrid")
      .Columns(columns =>
      {
          columns.Bound(c => c.AssetSubTypeID).Width(50);
          columns.ForeignKey(c => c.AssetTypeID, (System.Collections.IEnumerable)ViewData["assetTypes"], "AssetTypeID", "Type").Width(200);
          columns.Bound(c => c.SubType).Width(300);
          columns.Bound(c => c.Description).Width(300);
          columns.Bound(c => c.ProductTypeID).Width(100).Hidden();
          columns.Bound(c => c.PhysicalItem).Width(100).Hidden();
          columns.Bound(c => c.LastModified).Hidden();
          columns.Bound(c => c.LastModifiedBy).Hidden();
          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
      })
      .ToolBar(toolbar =>
      {
          toolbar.Create();
      })
      .ColumnMenu()
      .Editable(editable => editable.Mode(GridEditMode.InLine))
      .Pageable()
      .Reorderable(reorder => reorder.Columns(true))
      .Navigatable()
      .Selectable()
      .Groupable()
      .Resizable(resize => resize.Columns(true))
      .Sortable(sortable =>
      {
          sortable.SortMode(GridSortMode.MultipleColumn);
      })
      .Filterable(filterable => filterable.Mode(GridFilterMode.Menu))
      .Scrollable()
      .ClientDetailTemplateId("template")
      .HtmlAttributes(new { style = "height:800px;" })
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(15)
          .Events(events => events.Error("grid_error")) // Handle the "error" event
          .Model(model => model.Id(p => p.AssetSubTypeID))
          .Read(read => read.Action("AssetSubTypes_Read", "AssetAttribute"))
          .Create(create => create.Action("AssetSubTypes_Create", "AssetAttribute"))
          .Update(update => update.Action("AssetSubTypes_Update", "AssetAttribute"))
          .Destroy(destroy => destroy.Action("AssetSubTypes_Destroy", "AssetAttribute"))
      )
          //.Events(events => events.DataBound("dataBound"))
    )
</div>
<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<EMD.DAL.Domain.Attribute.SubTypeAttribute>()
                            .Name("attributeGrid_#=AssetSubTypeID#")
                            .Columns(columns =>
                            {
                                columns.Bound(c => c.SubTypeAttributeID).Hidden();
                                columns.Bound(c => c.AssetSubTypeID).Hidden();
                                columns.Bound(c => c.AttributeValueID);
                                //columns.ForeignKey(c => c.AttributeValueID, (System.Collections.IEnumerable)ViewData["attributes"], "AttributeValueID", "Attribute").Title("Attribute").Width(200);
                                columns.Bound(c => c.DefaultValue);
                                columns.Bound(c => c.Description);
                                columns.Bound(c => c.LastModified).Hidden();
                                columns.Bound(c => c.LastModifiedBy).Hidden();
                                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
                            })
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(5)
                                .Model(model => model.Id(p => p.SubTypeAttributeID))
                                .Read(read => read.Action("SubTypeAttributes_Read", "AssetAttribute", new { assetSubTypeID = "#=AssetSubTypeID#" }))
                                .Update(update => update.Action("SubTypeAttributes_Update", "AssetAttribute"))
                                .Create(update => update.Action("SubTypeAttributes_Create", "AssetAttribute").Data("onAddSubItem"))
                                .Destroy(update => update.Action("SubTypeAttributes_Destroy", "AssetAttribute"))
                             )
                            .ToolBar(toolbar =>
                            {
                                toolbar.Create().HtmlAttributes((new { onclick = "setMasterSubTypeID(this, #=AssetSubTypeID#)" }));
                                //toolbar.Excel();
                            })
                             .Editable()
                             .ColumnMenu()
                             .Sortable()
                             .Scrollable()
                             .Resizable(resize => resize.Columns(true))
                             .Filterable(filterable => filterable.Mode(GridFilterMode.Menu))
                             .Editable(editable => editable.Mode(GridEditMode.InLine))
        .ToClientTemplate()
    )

</script>

 

Funny thing is if I comment out the foreignkeycolumn on the detail grid (columns.ForeignKey(c => c.AttributeValueID,
(System.Collections.IEnumerable)ViewData["attributes"],
"AttributeValueID", "Attribute").Title("Attribute").Width(200);), and change it to bound. Everything works.

After searching various forums and making sure there is no spacing in field names and "encoder Type" is not defined in Web.config (http://www.telerik.com/forums/master-details-grid-not-working). I cannot get the grid to work.

I may be missing something very trivial but I just can't figure out why the grids work on their own but not when they are together.

Appreciate any thoughts.

Boyan Dimitrov
Telerik team
 answered on 05 Jun 2015
2 answers
132 views

I have a situation where Kendo works and renders correctly on my local VS dev environment, but when deployed to IIS I have two issues that I think are related.

1) Kendo controls are not rendering properly as if the css files are not fully recognized. For example, color BlueOpal is applied to the button, but the border is not the same.

2) Kendo control values are not reconized on IIS.  So for the following code:

@(Html.Kendo().Button()
.Name("showButton")
.HtmlAttributes(new { type = "submit", name = "ButtonType", value = "Show" })
.Content("Apply Selected Template"))

 So 'ButtonType' value of 'Show' works (in the controller) on local dev, but not when rendered by IIS. 

Kendo UI MVC version: 2015.1.318

I verified that all the script, content, css, etc. files are fully copied and identical on IIS as they are in my dev environment.

Dimo
Telerik team
 answered on 04 Jun 2015
1 answer
451 views

I need to be able to enter multiple values or ranges into a textbox, similar to MS Words print page function.

So, I could have something like 1-3, 7-10, 15,16. And I need to allow only numeric or commas.

Can that be done using the NumericTextBox?

If not, any ideas how I could accomplish this?

TIA,

Bob

Atanas Georgiev
Telerik team
 answered on 04 Jun 2015
2 answers
436 views

I have a simple grid that uses a custom popup editor template. In the template, I'd like to use a Numeric Textbox.

Due to localization, the application keeps trying to use a comma to separate decimals in the numeric values. When these values are passed to the ASP.NET MVC back-end, the value is lost and null is passed. How can I ensure the posted value has a period separator?

I have tried setting the underlying field values to 2.5 instead of 2,5 in the grid's Save event, as well as tried to overwrite the e.model.WeightKg to 2.5. The value is still passed with a comma separator, as shown by inspecting the form data in the request.

 My grid:

01.@(Html.Kendo().Grid<PackageViewModel>()
02.    .Name("PackageGrid")
03.    .Columns(columns => {
04.        columns.Bound(o => o.PackageCode);
05.        columns.Bound(o => o.WeightKg);
06.        columns.Command(o => o.Edit());
07.    })
08.    .DataSource(d => d
09.        .WebApi()
10.        .Model(m => m.Id(o => o.PackageCode))
11.        .Read(c => c.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "Packages" })))
12.        .Create(c => c.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "Packages" })))
13.        .Destroy(c => c.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "Packages" id = "{0}" })))
14.        .Update(c => c.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "Packages" id = "{0}" })))
15.        .PageSize(20)
16.    )
17.    .Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("Package"))
18.    .Selectable()
19.    .Deferred()
20.)

The numeric textbox in the template:

1.@Html.Kendo().NumericTextBoxFor(m => m.WeightKg).Decimals(8)

And the unparsed form data, followed by the parsed form data:

sort=&group=&filter=&PackageCode=DOOS-B&WeightKg=2%2C5
 
sort:
group:
filter:
PackageCode:DOOS-B
LeegGewichtKg:2,5

Rosen
Telerik team
 answered on 04 Jun 2015
1 answer
540 views

Hey,

 I have a grid with a datasource that needs to have all of its datasource modifications done server side because the results can be quite large and I want to use the filters provided. I see that the DataSourceRequest returns a list of filters, however these filters can come back in a number of different structures depending on the number of filters applied. 

I was wondering if you had a solution for converting these into something that can be used to query oData or converted in to linq where clauses.

Kiril Nikolov
Telerik team
 answered on 04 Jun 2015
2 answers
147 views

Hello,

I have loaded data in Horizontal grouping Scheduler but could not load into vertical grouping scheduler. Grouping are showing correctly but no data is coming into the cells. 

Can you please give me the sample of "Vertical_Read" and "Vertical_Create" action methods?

Here is my scheduler vertical grouping's razor code:

                     @(Html.Kendo().Scheduler<TaskViewModel>()
                        .Name("schedulerVertical")
                        .Selectable(true)
                        .Date(new DateTime(2015, 5, 24))
                        .StartTime(new DateTime(2015, 5, 24, 7, 00, 00))
                        .Height(600)
                        .Views(views =>
                        {
                            views.DayView();
                            views.WeekView(weekView => weekView.Selected(true));
                            views.MonthView();
                            views.TimelineView();
                        })
                        .Timezone("Etc/UTC")
                        .Group(group => group.Resources("Skills", "Techs").Orientation(SchedulerGroupOrientation.Vertical))
                        .Resources(resource =>
                        {
                            resource.Add(m => m.SkillID)
                                .Title("Skills")
                                .Name("Skills")
                                .DataTextField("SkillName")
                                .DataValueField("SkillID")
                                .DataColorField("Color")
                                .DataSource(d => d.Read("Skills", "Scheduler"));
                            resource.Add(m => m.Techs)
                                .Title("Techs")
                                .Name("Techs")
                                .Multiple(true)
                                .DataTextField("TechName")
                                .DataValueField("TechID")
                                .DataSource(d => d.Read("Techs", "Scheduler"));
                        })
                        .DataSource(d => d
                                .Model(m =>
                                {
                                    m.Id(f => f.MeetingID);
                                    m.Field(f => f.Title).DefaultValue("No title");
                                    m.RecurrenceId(f => f.RecurrenceID);
                                    m.Field(f => f.Title).DefaultValue("No title");
                                })
                                .Read("Vertical_Read", "Scheduler")
                                    .Create("Vertical_Create", "Scheduler")
                                    .Destroy("Vertical_Delete", "Scheduler")
                                    .Update("Vertical_Update", "Scheduler")
                        )
                    )

 

 Can you please give me the sample of "Vertical_Read" and "Vertical_Create" action methods?

Vladimir Iliev
Telerik team
 answered on 04 Jun 2015
5 answers
512 views

Hi

I just started the evaluation of the MVC wrappers for Kendo UI.  While I am not a novice in development (including MVC) I am a bit confused how you handle things and how to achieve the basic functionality.

I need to be able to work with the grid control inside the panel that would be coming as a result of the higher level AJAX call.  My current preference is the server binding - the binding that renders the grid HTML during the single round of rendering.  However, our users should be able to sort by columns, filter rows - all standard functionality; and that functionality must not reload the entire browser window - only the grid.

So I created the test scenario - the Index action returns the view, which renders the basic skeleton HTML with the target DIV.  After page loading I invoke AJAX call using jQuery to another action of my controller - simulating the real case scenario when views will be coming dynamically.  That action returns the partial view that calls for a grid.

@model List<Telerik1.Models.Item>

@* Basic Kendo MVC Grid sortable by Age column *@
@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.ID).Groupable(false).Sortable(false);
        columns.Bound(p => p.Name).Groupable(false).Sortable(false);
        columns.Bound(p => p.Age).Groupable(false).Sortable(true);
    })
    .Pageable()
    .Sortable(sort => sort.SortMode(GridSortMode.SingleColumn).AllowUnsort(false))
    .Scrollable()
    .Filterable()
        .DataSource(ds => ds
            .Ajax()
            .Sort(s =>
            {
                s.Add("Age").Ascending();
            })
            .Read(cfg => cfg.Action("Read", "Eval1"))
        )
)

I tried several things.  

My initial attempt was to use .Server() for the data source.  When I clicked on the "Age" column for sorting, your component redirected the entire page to its Index view (attaching grid's routing values to that address).  It took me awhile to recognize why I was always getting the initial grid.

After that I switched the binding to .Ajax().  With that I pointed the .Read action to an action that returns the data source as a JSON collection but also tried to point to the action that calls for the partial view with the grid.  In either case, when I try to sort or filter the result of the AJAX call is an empty grid.

I am sure I am missing something basic- some setting that would direct your component to the "Grid" action which returns the partial view with the grid specification - but I cannot pinpoint it.  And I really cannot find the documentation article nor forum or blog entry, which would clearly explain the binding mechanisms, options and their implications in crystallized way.

I am attaching my sample project in hope of you spotting that missing thing.  There is Eval1 controller, which I am using for evaluation.
Please note that I have removed Scripts and Content folders from the attachment to reduce the size of the attachment.
Please also note that the project was created by creating an empty MVC application and running your "Convert to Telerik application" wizard.

 

 

 

 

Dimo
Telerik team
 answered on 04 Jun 2015
1 answer
233 views

Please help us how to create inline editing in Hierarchy grid.  Please provide the sample for this grid.

 

Thanks

Senthilkumar N

Vladimir Iliev
Telerik team
 answered on 04 Jun 2015
1 answer
2.8K+ views
Please let us know how to apply custom styles in kendo grid and please share some sample code.
Dimo
Telerik team
 answered on 04 Jun 2015
4 answers
112 views
I have a page with a listview and a textbox underneath the listview in a pretty basic setup, it's basically a chat tool.  I'm using signalR to tell the listview when it's time to refresh, and when that happens I call a .dataSource.read() on the listview.  This works great, except that the textbox underneath the listview is basically frozen until the read call is done.  Once the read is done, then everything works fine, but the user experience is pretty bad.  Why is my entire page unusable while this read is going on?  Is there a way i can call this asynchronously that i'm not aware of?  Thanks for any help you can provide.
BRAD
Top achievements
Rank 1
 answered on 04 Jun 2015
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
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?