Telerik Forums
UI for ASP.NET MVC Forum
1 answer
289 views

Hi,

I am trying to edit a cell inline. When there is an error in the update controller, the model state returns an error but the cell value gets changed to the edited value which threw error. I want to retain the earlier value if there are any errors in the model state without calling the data source read() method.

Is there any way to achieve this?

 

Thank you.

Veselin Tsvetanov
Telerik team
 answered on 05 May 2017
3 answers
329 views

I have the Kendo UI grid setup with one column that has a Date datatype. The filter menu comes up correctly (extras: true) with two Date Picker widgets, what I'm trying to do is default the value in the textbox in the first widget to the first of the month and the second textbox to be set to the last day of the month as soon as the filter menu is opened.

I haven't been able to find any examples on how to set this, any info would be much appreciated.

Thanks.

 

 

Preslav
Telerik team
 answered on 05 May 2017
2 answers
450 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.5K+ 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
57 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
176 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
82 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
204 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.2K+ 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
291 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?