Telerik Forums
UI for ASP.NET MVC Forum
9 answers
1.2K+ views

Hi,

I'm using the currently using the Grid with server side processing, grouped by Project Name, and using the ClientGroupFooterTemplate to display totals. This works great, but is there a way to add a sub-total row, for some other calculations?

I'm currently querying the items needed and then query the sub-totals row then concatenating the queries this is drastically slowing the load time.

Any ideas?

public ActionResult ProjectTaskListAjax(Guid id, [DataSourceRequest] DataSourceRequest request)
{
    var tasks = DataService.GetQueryableProjectTasksByUploadId(id);
 
    var queries = new[]
    {
        // This gets all the current tasks
        tasks.Select(x => new GridProjectTaskModel
        {
            [...]
            LabourCostTotal = x.LabourCostTotal,
            MaterialCostTotal = x.MaterialCostTotal,
            [...]
        }),
 
        // This gets all the tasks then groups by the Project and then calculates two columns that need to be displayed on the 'sub-total' row.
        tasks.GroupBy(x => x.Project.Name).Select(g => new GridProjectTaskModel
        {
            [...]
            LabourCostTotal = g.FirstOrDefault().PurchaseOrders.Where(x => x.SupplierType == "Sub-Contract Labour").Sum(x => x.TotalEx),
            MaterialCostTotal = (g.FirstOrDefault().PurchaseOrders.Where(x => x.SupplierType == "Sub-Contract Labour").Sum(x => x.TotalEx) * -1),
            [...]
        })
    };
 
    // Concat vs Union makes no difference here
    var mergedQuery = queries.Select(query => query.AsEnumerable()).Aggregate(Enumerable.Union);
 
    return Json(mergedQuery.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
Viktor Tachev
Telerik team
 answered on 08 May 2020
2 answers
116 views

Hi 

Is there any option to display the DropdownList in the Grid default page loading. I tried this option when we click the cell only its displaying dropdownlist.

https://demos.telerik.com/aspnet-mvc/grid/editing-custom?_ga=2.231591000.698409247.1588223224-368114355.1588223224

 

Help will be appreciated!!

Mohammed
Top achievements
Rank 1
Veteran
 answered on 06 May 2020
2 answers
236 views

Hi,

 

I want to display Mobile switch control in Grid MVC . when i tried only checkbox displaying.

 

Please help

Mohammed
Top achievements
Rank 1
Veteran
 answered on 06 May 2020
1 answer
93 views
I have a records of value in Date column where date and time is given in MM/dd/yyyy hh:mm  but while selecting filter for date column in the menu it is giving empty records 
Preslav
Telerik team
 answered on 06 May 2020
1 answer
130 views

Hi,  I am trying to make my calendar 3 months view with padding of 16px just like the demo.  But its not working, some Telerik css is overwriting it.  Even if I try to force it inline for each month its not working.

 

 

Preslav
Telerik team
 answered on 06 May 2020
1 answer
215 views

 Hi 

I want to show 2-3 seconds max 2-3mb size video preview in grid cell.

Is it possible?

Ianko
Telerik team
 answered on 06 May 2020
9 answers
1.7K+ views

Hi there,

I am using this code in the Html.Kendo().Grid:

columns.Bound(p => p.Positive).ClientTemplate("<input type='checkbox' \\#= Positive ? checked='checked' :'' \\# />");

In the login form I use a @Html.Kendo().CheckBoxFor (checkbox for 'remember me').

How can I change the style of the rendered checkbox in the grid to the style of the kendo checkbox?

Kind regards,

David

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 05 May 2020
3 answers
1.9K+ views

I am binding a Kendo grid using Ajax binding. In the last column of the grid I want to show action buttons based on the status. In html I have a kendo template. But im not sure how to set kendo template in grid column using it's ID.

I'm open for any other suggestions, if there are any other ways to do this.

<div>
    @(Html.Kendo().Grid<BatchDetail>()
    .Name("grid")
    .Columns(col =>
    {
        col.Bound(p => p.ID);
        col.Bound(p => p.OriginalCost);
        col.Bound(p => p.Status);
       //how do I add new column here which is not bound to any property, but it need to render a template below 
    })
    .AutoBind(true)
    .Pageable()
    .Sortable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read
            .Action("GetData", "Detail", new { ID = Model.ID })))
    )
</div>
 
<script id="action-template" type="text/x-kendo-template">
    #if(Status == "Error") {#
    <button class="resolve-button"
            onclick="location.href='@Url.Action("DoAction", "Detail")?fileID=#: FileID #&ID=#: ID#'">
        Resolve
    </button>
   #}#
</script>

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 05 May 2020
3 answers
70 views

Hello EveryOne,

so I have two schedulers and I made for each Scheduler a CustomEditor.

Events Scheduler and Communication Scheduler...

In Both CustomEditor I have a Type DropDownList but each one is calling the items in the list from another table (another ActionMethod).

So one of the Type DropDownList works fine .. and by fine I mean if I edit an event and I change the value in the list .. it sends the new selected value to the actionMethod.

But the other one is working with one condition  !!

So I tested almost all options that I can do .. and one was WEIRD!

So that's what I did :

1- Create an Event

2- Give a Value for Type

3- Save the Event

4- Edit that Event

5- Change the value of Type

6- Save the Event

Now at step 6 .. it sends all new values to the ActionMethod...

but if I created an event and give it just a Title and Time without giving it a Type Value then try to do steps 4,5 and 6 .. it sends a value [object][Object] to the ActionMethod.

Now This is not a new problem .. I've seen others asking almost the same question .. but the answers there didn't help me much.

So Please .. any Solution will be great...

PS: This Worked Fine before two days .. now it doesn't 

Veselin Tsvetanov
Telerik team
 answered on 05 May 2020
1 answer
894 views

     Hi All

 

We are new to Kendo, hence this might be a simple scenario that we are not able to get around.

 

We have a grid, in which Employee Name column is actually a DropDown selection with in column that uses DropDownFor. We initially bound our column to Employee Object in the Model, but then Filtering, Export to Excel etc features didn't work. Upon some research we found that we need to bind to a view model that has only basic data types and not any complex data types.

We then created a view model on top of our Model and bind that to grid, but doing this we have lost the Employee Id which was earlier being set properly. Grid now shows Employee Name only which is not a unique field, we need to know the ID of selected member.

 

Can you please help us understand how we bind an object to column and still preserve all features of the grid like Filtering etc. 

If that is not possible can you suggest a way where in we can set ID of selected employee within viewmodel and not just name.

 

Please let me know if I can explain any further.

 

Thanks

M.

Tsvetomir
Telerik team
 answered on 05 May 2020
Narrow your results
Selected tags
Tags
+133 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
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
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?