Telerik Forums
UI for ASP.NET MVC Forum
2 answers
511 views

I want to render a treeview and a tabstrip within a page. This tabstrip will have three tabs each of which will render a grid inside it.

<div class="row">
    <div class="demo-section narrow tree-view">
        <div>
            @(Html.Kendo().TreeView()
                .Name("AssetTreeView")
                .DataTextField("Name")
                .DataSource(dataSource => dataSource
                    .Read("ReadCategories", "Software")
                    .Model(categoriesModel => categoriesModel
                        .Id("Id")
                        .Children(clientHw => clientHw
                            .Read("ReadClientHWs", "Software")
                            .Model(clientHWModel => clientHWModel.Id("Id"))
                        )
                    )
                )
                .Events(events => events
                    .Select("onNodeSelected"))
            )
        </div>
    </div>
 
    <div class="demo-section wide grid">
        @(Html.Kendo().TabStrip()
        .Name("SoftwareTabStrip")
        .Animation(animation =>
                animation.Open(effect =>
                    effect.Fade(FadeDirection.In)))
        .Items(tabstrip =>
        {
            tabstrip.Add()
                    .Text("Blacklisted")
                    .Selected(true)
                    .ImageUrl("~/Content/Images/32x32/traffic-light-red.png")
                    .ImageHtmlAttributes(new { style = "width: 32px; height: 32px; padding: 3px;" })
                    .Content(@<text>Blacklisted is bad!
                        @(Html.Kendo().Grid<MyIT.ModelsInterfaces.Models.MyIT.Software>()
                            .Name("BlacklistedSoftwareGrid")
                            .Columns(columns =>
                            {
                                columns.Bound(s => s.Publisher).Width(250);
                                columns.Bound(s => s.SoftwareName).Width(250);
                                columns.Bound(s => s.Version).Width(100);
                                columns.Bound(s => s.Description).Width(400);
                            })
                            .NoRecords("No blacklisted software installed...")
                            .Pageable()
                            .Sortable()
                            .Scrollable(x => x.Height(400))
                            .Filterable()
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(20)
                                .Read(read => read.Action("GetRedSoftware", "Software").Data("additionalData"))
                            )
                            .Events(events => events
                                .DataBound("onBlacklistedBound")
                                .DataBinding("onDataBinding"))
                        )
                    </text>);
 
            tabstrip.Add()
                .Text("Other Software")
                .ImageUrl("~/Content/Images/32x32/traffic-light-yellow.png")
                .ImageHtmlAttributes(new { style = "width: 32px; height: 32px; padding: 3px;" })
                .Content(@<text>Yellow is allowed!
                    @(Html.Kendo().Grid<MyIT.ModelsInterfaces.Models.MyIT.Software>()
                            .Name("UnsupportedSoftwareGrid")
                            .Columns(columns =>
                            {
                                columns.Bound(s => s.Publisher).Width(250);
                                columns.Bound(s => s.SoftwareName).Width(250);
                                columns.Bound(s => s.Version).Width(100);
                                columns.Bound(s => s.Description).Width(400);
                            })
                            .NoRecords("No software available...")
                            .Pageable()
                            .Sortable()
                            .Scrollable(x => x.Height(400))
                            .Filterable()
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(20)
                                .Read(read => read.Action("GetYellowSoftware", "Software").Data("additionalData"))
                            )
                            .Events(events => events
                                .DataBound("onUnsupportedBound")
                                .DataBinding("onDataBinding"))
                    )
                </text>);
 
            tabstrip.Add()
                .Text("Supported")
                .ImageUrl("~/Content/Images/32x32/traffic-light-green.png")
                .ImageHtmlAttributes(new { style = "width: 32px; height: 32px; padding: 3px;" })
                .Content(@<text>Green is supported!
                    @(Html.Kendo().Grid<MyIT.ModelsInterfaces.Models.MyIT.Software>()
                            .Name("SupportedSoftwareGrid")
                            .Columns(columns =>
                            {
                                columns.Bound(s => s.Publisher).Width(200);
                                columns.Bound(s => s.SoftwareName).Width(200);
                                columns.Bound(s => s.Version).Width(100);
                                columns.Bound(s => s.Description).Width(400);
                            })
                            .NoRecords("No software available...")
                            .Pageable()
                            .Sortable()
                            .Scrollable(x => x.Height(400))
                            .Filterable()
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(20)
                                .Read(read => read.Action("GetGreenSoftware", "Software").Data("additionalData"))
                            )
                            .Events(events => events
                                .DataBound("onSupportedBound")
                                .DataBinding("onDataBinding"))
                    )
                </text>);
        })
        )
    </div>
</div>

The treeview should always return one node (HW Category) expanded with one of it's child node (ClientHW) selected. 

Note: ReadClientHWs action method below will return node object with one of the property named "selected"

public class SoftwareController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
 
    public ActionResult ReadCategories()
    {
        var categories = from category in _clientHWService.GetMajorAssetCategoriesOfUser(_myITService.GetCurrentUser())
                         select category;
 
        return Json(_mapperService.MapToClientHWCategoryItems(categories),
            JsonRequestBehavior.AllowGet);
    }
 
    public ActionResult ReadClientHWs(int id)
    {
        var clientHardwares = from hw in _clientHWService.GetMajorAssetsForUser(_myITService.GetCurrentUser())
                              where hw.UsedAsId.Equals(id)
                              select hw;
 
        return Json(_mapperService.MapToClientHWItems(clientHardwares), JsonRequestBehavior.AllowGet);
    }
 
    public ActionResult GetGreenSoftware([DataSourceRequest] DataSourceRequest request, string computerName)
    {
        return Json(_softwareService.GetGreenSoftwares(computerName).ToDataSourceResult(request));
    }
 
    public ActionResult GetYellowSoftware([DataSourceRequest] DataSourceRequest request, string computerName)
    {
        return Json(_softwareService.GetYellowSoftwares(computerName).ToDataSourceResult(request));
    }
 
    public ActionResult GetRedSoftware([DataSourceRequest] DataSourceRequest request, string computerName)
    {
        return Json(_softwareService.GetRedSoftwares(computerName).ToDataSourceResult(request));
    }
}

I successfully made the grid loads the correct data every time user click one of the ClientHW nodes. but I haven't been able to render the grid base on this selected node the first time the page load.
how can i accomplish this?

Raditya
Top achievements
Rank 1
 answered on 05 May 2017
1 answer
1.6K+ views

Hi,

We're displaying some data in an Kendo MVC Grid where the source data is stored in local time.  However when it gets printed in the Kendo grid, Kendo seems to assume the source data is in UTC and tries to convert it to the time zone of the web browser.

So in the database the time is: 2017-05-02 00:00:21.000

...but in the grid it displays as : 02/05/2017 01:00

How can we stop Kendo Grid from attempting to convert the data and just display it literally?

Thanks,

Nick

Leon
Top achievements
Rank 1
 answered on 04 May 2017
2 answers
92 views

Hi,

 

I'm attempting to use a grid control, but I find that filtering does not work for me. I thought that maybe the problem was with script registration, but that was a guess. I really have no idea.

Here's the grid:

@Html.Kendo().Grid(Model).Name("JobsRecurringGridEx").DataSource(d => d.Ajax()
        .Model(m => m.Id(o => o.ID))      
        .Read(r => r.Action("GetJobsRecurringAll", "Home"))
        .Update(r => r.Action("UpdateJobsRecurring", "Home"))
        ).Columns(col =>
        {
            col.Bound(o => o.ID);
            col.Bound(o => o.JOB_NAME);
            col.Bound(o => o.DBID);

            col.Bound(o => o.PARAMETER_1).Hidden(true);
            col.Bound(o => o.PARAMETER_2).Hidden(true);
            col.Bound(o => o.PARAMETER_3).Hidden(true);
            col.Bound(o => o.PARAMETER_4).Hidden(true);
            col.Bound(o => o.PARAMETER_5).Hidden(true);
            col.Bound(o => o.PARAMETER_6).Hidden(true);
            col.Bound(o => o.PARAMETER_7).Hidden(true);
            col.Bound(o => o.PARAMETER_8).Hidden(true);
            col.Bound(o => o.PARAMETER_9).Hidden(true);
            col.Bound(o => o.PARAMETER_10).Hidden(true);

            col.Bound(o => o.START_RUN_DATE_TIME);
            col.Bound(o => o.LAST_RUN_DATE_TIME);
            col.Bound(o => o.NEXT_RUN_DATE_TIME);
            col.Bound(o => o.SEED_RUN_DATE_TIME);
            col.Bound(o => o.RUN_INTERVAL);
            col.Bound(o => o.ACTIVE);
            col.Bound(o => o.PAUSED);
            col.Bound(o => o.CREATED_BY);
            col.Bound(o => o.CREATED_DATE_TIME);
            col.Bound(o => o.CRON_SCHEDULE);
        }).Editable(e => e.Mode(GridEditMode.InCell)).ToolBar(tb => tb.Save()).Pageable().Sortable().Filterable()

 

Some columns are initially hidden, to be shown later. That part works. But attempting to filter has no effect. I don't know how to begin to debug this.

 

???

Help
Top achievements
Rank 1
 answered on 04 May 2017
0 answers
237 views

I have a view which contains a kendo grid.  When a user clicks on a link in the grid I am calling some javascript that opens a Kendo window which loads a partial view containing another kendo grid.  In the partial I have a div which contains the code for the grid.

When it executes, the grid in the kendo window loads and populates, but does it outside of the containing grid.  Inside of the containing div is kendo code that contains the k-no-data portion of the grid which displays on the page even though there is data displayed in the grid being rendered underneath.  If I set the height of the grid it affects the k-no-data portion of the grid and not the grid with the data being rendered underneath.  Please help.

Rogerio
Top achievements
Rank 1
 asked on 04 May 2017
1 answer
124 views

I have a editible grid with a ToolBar.Create that pops up a template,  I would like to have the template popup when entering the view and grid is 1st displayed,  Ie On datbound or similar

 

how can the grid enter create mode and have the popuyp appear automatically.

 

Thanks

Viktor Tachev
Telerik team
 answered on 04 May 2017
3 answers
308 views

Is there a way to localize SubMenu in Filter part of the ColumnMenu and in a more general way to localize all the ColumnMenu content.

It seem's that :

    <script src="~/lib/kendo/js/cultures/kendo.culture.fr-FR.min.js"
            type="text/javascript"></script>
   <script type="text/javascript">
    kendo.culture('fr-FR');
  </script>

has no effect, it is still in English.

Best regards.

Alex Hajigeorgieva
Telerik team
 answered on 03 May 2017
3 answers
2.4K+ views

How do I apply custom HtrmlAttributes to custom tookbar or command buttons in a TreeList (using the MVC wrapper) ?

 

on Kendo Grids, we have used this extensively to set styling and tooltips, e.g. 

.ToolBar(toolbar => { toolbar.Custom().Text("").HtmlAttributes(new { id = "btnClearFilters", @class = "pm-btnFilterClear", title = "Clear all filters" }); })

However, there appears to be no equivalent HtmlAttributes methods on the TreeList toolbar or custom command buttons. 

 

Thanks.

 

Stefan
Telerik team
 answered on 03 May 2017
5 answers
345 views

Is the a way when the PanelBar is expanded it just overlays existing Html instead of pushing it down?

 

Thanks

 

 

Greg
Top achievements
Rank 1
 answered on 02 May 2017
3 answers
1.4K+ views
Hi everyone,
I have a grid with a DateTime inside, I want to modify it with inCell editing.

This is my grid definition:

@(Html.Kendo().Grid(Model.row)
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(l => l.LRId).Hidden();
        columns.Bound(l => l.StartDate).Format("{0:d}");
        columns.Bound(l => l.Amount);
 
        columns.Command(command => command.Custom("logicalDelete"));//.Click("udmAltDelete"));
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(ed => ed.Mode(GridEditMode.InCell))
    .DataSource(ds => ds
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Model(model =>
        {
            model.Id(l => l.LRId);
        })
        )
)

When the grid show data correctly formatted with "Short date format" (look image attached: View.png),
but when i modify the date the grid modify the format (look image attached: Modify.png).

How can I have the same format for view and editing data?
Viktor Tachev
Telerik team
 answered on 02 May 2017
4 answers
271 views
I followed the ajax editting docs and I have server side validation error correctly getting displayed.  But the grid action still completes and the grid reverts back to view mode instead of staying in edit mode so I can correct the errors.

How do I get the grid to not update itself?
Boyan Dimitrov
Telerik team
 answered on 02 May 2017
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?