Telerik Forums
UI for ASP.NET Core Forum
1 answer
1.2K+ views

This question is what I faced when I'm trying to build CRUD with Grid,
I got multiple grids in one view, and each grid shows different infos depends on the model,
I'll use a simple model as example:
Model1:

public class Model1
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }

What Ive tried already, I can pass Model1 with IQueryable data to view like below when there is only one model

 public IActionResult Data_Read([DataSourceRequest] DataSourceRequest request)
        {   
               IQueryable<Model1> datas = Model1 that I Queried
               DataSourceResult dataresult = datas.ToDataSourceResult(request);
               return Json(dataresult);
        }
The question is how can I pass multiple models with one view model,
I'm guessing the view model would be something like this: 

public class MultipleModelViewModel { public IQueryable<Model1> Model1 { get; set; } public IQueryable<Model2> Model2 { get; set; }

}

But when I tried to do as what I imagined,
I was not able to use the extension method ".ToDataSourceResult(request)" with a View Model

public IActionResult Data_Read([DataSourceRequest] DataSourceRequest request) { IQueryable<Model1> datas = Model1 that I Queried
MultipleModelViewModel.Model1 = datas;


//can't use the ".ToDataSourceResult" extension method with the ViewModel
DataSourceResult dataresult = MultipleModelViewModel.ToDataSourceResult(request);
return Json(dataresult); }


The other thing I'm assuming is, this view model should be work via CRUD operations,
since the grid is counting on the view model to bind the datas,
and so I'm guessing that when client creates a row of data, 
the new data should be passed back to the "Create" action via the view model,
Dont know if I am right,
Can anyone help?

Aleksandar
Telerik team
 answered on 10 Nov 2021
1 answer
194 views

Hi,

Upgrading to Kendo UI v2021.3.914 dialog titles are now truncated to half the dialog width.

As per here: https://netcorerepl.telerik.com/cvPPafaS01WpoJLM05   where the only change is the title. 

Is there a workaround for this?

thanks

Rod

 

Alexander
Telerik team
 answered on 09 Nov 2021
1 answer
142 views

I am trying to load a combobox inside a kendo window, but it does not load me. the code I have is the following:

@{Html.Kendo().Window()
.Name("winAplicar")
.Title(Resource.TituloAsignar)
.Draggable(false)
.Scrollable(false)
.Modal(true)
.Width(950)
.Height(200)
.Visible(false)
.Render();
}

the following function takes care of obtaining the model that will contain the window

function abrirVentana() {
            var win = $("#winAplicar").data("kendoWindow");
            var url = '@Url.Action("_CambiarEstatus", "AsignaPoliticaPago", new { area = "Nomina" })';

            win.refresh({
                url: url
            });
            setTimeout(function () {
                win.center().open();
            }, 200)
        }

                            

public ActionResult _CambiarEstatus(SecurityContext securityContext)
        {

                return View(new AsignaPoliticaPagoViewModel() { CLA_POLITICA_PAGO2 = 2 });

        }

but it only shows it in blank

 

Mihaela
Telerik team
 answered on 09 Nov 2021
1 answer
473 views

Good afternoon,

I've managed to successfully produce a pie chart reading remote data, but the pie chart fills the div meaning the labels are unreadable - I've included a simple example below with just two labels, but one is illegible. The div it's in has class "k-content wide".

When there are more labels, they appear over the title.

Is there a way to make the size of the chart adapt to the size of the div it sits in so that all the labels are legible?

Kind regards,

Richard

Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
 answered on 08 Nov 2021
1 answer
1.0K+ views

Good afternoon 

If we look at the following demo page, we see Discontinued as a bool

https://demos.telerik.com/aspnet-mvc/grid/editing

Now I understand we can change the bound column to use a ClientTemplate to change true/false to a checkbox like so:

columns.Bound(p => p.Discontinued).ClientTemplate(
              "<input type='checkbox' value='#= Bin_ID #' " +
                 "# if (SiteHasBin) { #" +
                     "checked='checked'" +
                 "# } #" +
              "/>").Width(100);

What I am struggling with is how we go about removing the "click once to enter edit mode, click again to uncheck/check the checkbox before clicking save"

How do I go about effectively removing/hacking the existing code so that if a user sees a checkbox, they just click the checkbox AND the batch editing works out the box?

 


Aleksandar
Telerik team
 answered on 08 Nov 2021
0 answers
482 views

Hello,

I have a scheduler with a day, week,  month, and agenda view. I have set up a template for the agenda view and it is displaying properly. I also have a generic one set up that should be applied to day, week, and month but only the month view is showing, the other two get the generic view. Any ideas on this?

Thanks,

Scott

Scott
Top achievements
Rank 1
 asked on 04 Nov 2021
2 answers
193 views

Afternoon,

I have a form which uses

        .ButtonsTemplateId("saveTemplate")

<script type="text/x-kendo-template" id="saveTemplate">
    <button class="k-button k-primary">Save Changes</button>
             &nbsp;&nbsp;
    <button type="button" class="k-button" formaction="@Url.Action("Index");">Back to List</button>
</script>

I need the second button to return to the Index without submitting the form or causing validation.

How can I achieve this?

Many thanks,

Richard

Mihaela
Telerik team
 updated answer on 02 Nov 2021
0 answers
156 views

Hello, I'm using the orgchart control for .net core MVC (Telerik: 2021.3.914), and I have a custom template for each node. It works perfectly, but I want to add a kendo popover on an icon. How do I go about using a popover within the template? The icon id and body would be dynamic, so I'm not sure how to get that working. I have a field named StatusTypeName that I have defined on the orgchart control, that I want to use as the body.

<script id="tmpDetails" type="text/kendo-tmpl">        
    <ul class="list-group">
        <li class="list-group-item bg-alpha text-white-50 px-3">
            <div class="form-row">
                <div class="col-md-1">
                    <i id="iStatus_#:id#" class="fa fa-circle align-self-center mr-2
                    #if (data.StatusTypeID == 1){#status-paused#}#
                    #if (data.StatusTypeID == 2){#status-started#}#
                    #if (data.StatusTypeID == 3){#status-cancelled#}#
                    #if (data.StatusTypeID == 4){#status-completed#}#
                    " style="padding-top: 1px;"></i>
                    @(Html.Kendo().Popover()
                        .For(???)
                        .Position(PopoverPosition.Top)
                        .ToggleOnClick(true)
                        .Body(#:StatusTypeName#)
                        .ToClientTemplate()
                    )
                </div> 

Michael
Top achievements
Rank 1
 asked on 02 Nov 2021
1 answer
932 views

I love using all the kendo widgets you offer. But why is the drawer component so hard to use?

My approach is to use a global navigation sidebar. Currently I'm using the panelbar as navigation but somehow I have the feeling that the kendo panelbar was never intended to be a navbar.

So I looked again in the demos and saw the drawer. As described in the introduction it is intended to be used as a side navigation. Also I figured out that the left sidebar on the demo pages (where you can navigate through the available widgets kendo offer) is a drawer too. So I thought hey, maybe it is just the thing you need right now!

But then I tried to implement it in my app and it is a mess compared to all the other available kendo components. Just a few things I noticed, maybe somebody can answer me the points:

  1. Why is the widget automatically configured to use a "content"? When not defining a content (because I want the widget just for navigation, not for showing any content by clicking on a item because the widget should only navigate me to other pages), I have to mess with the css that the space for the content is disapearing (see in the picture).
  2. Why this widget doesn't support to create the items via razor syntax? A lot of other components support to add its items through razor via ".Items(x => x.Add().Text("Home"))". Here I have to configure so much html to create a simple, small and lightweight menu via ".Template(@"[..]")".
    In addition, the kendo panelbar supports even to add an action behind every item through ".Action("Index", "Home")" (exactely what I need and what I'm using right now).
  3. Why is the collapsing of a submenu not integrated in the component? In the demo under "Hierarchy" I have to register the "ItemClick"-event and have to insert the whole logic for collapsing in javascript. Yes, you provided a working script but why it isn't a built-in feature of the component?
  4. Or maybe I'm wrong and the drawer is not the component I'm searching for? In my opinion the drawer is comparable to a vertical tabstrip where all the content is already existing in background and after clicking on an item the content will be shown. It's not really working like a navigation bar which will provide you to the set url. Somehow I wonder why I am the only one who wants a simple sidebar navigation with hierarchy, where it will redirect me to the page by clicking on its item.

In the second picture you see the super easy to use panelbar as my current navigation bar in my application compared to the drawer I tried to integrate. Like I said I have the feeling the panelbar component is not intended to be a navbar. Also it has a bug which I already reported to you and which is pretty annoying (https://github.com/telerik/kendo-ui-core/issues/6528).

Mihaela
Telerik team
 answered on 01 Nov 2021
1 answer
949 views
Hi,

Is there any way to disable the entire grid?
the scenario is when the page was browsed in the first time,
I used a parameter with if statement to jumpover the grid from showing cloumns.
After the user enters the search parameter, the grid showed up with data.
What if there is no data, how can I disable the entire grid?
Petar
Telerik team
 answered on 27 Oct 2021
Narrow your results
Selected tags
Tags
+? 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?