GridRow no longer available in asp.net core package

1 Answer 83 Views
Grid
Albert
Top achievements
Rank 1
Albert asked on 12 Dec 2022, 05:11 PM

Hi,

I'm currently migrating an MVC 5 project to .NET 6 and I'm having some issues with some of the extensions methods usedin MVC5 due to some classes being deprecated.

Previously we were setting someclasses on the row using a couple of extension methods:

C# Extension method


        public static void HighlightRows<T>(this GridRow<T> row, IEnumerable<Tuple<Func<T, bool>, string>> expressions)
            where T : VM
        {
            var classes = new List<string>();
            foreach (var expression in expressions)
            {
                if (expression.Item1(row.DataItem))
                {
                    if (!String.IsNullOrEmpty(expression.Item2) && classes.Count == 0)
                        classes.Add(expression.Item2);
                }
            }
            if (classes.Count > 0)
                row.HtmlAttributes["class"] = String.Join(" ", classes);
        }

And usage:

 


        @(Html.Kendo().Grid(Model.Entities)
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(c => c.Name);
                columns.Bound(c => c.Status);
            })
            .RowAction(r =>
            {
                r.HighlightRow(new[]
                {
// if status is complete then set row class to success(set background togreen) is status is error set background to red basically.
                    Tuple.Create<Func<MyVm, bool>, string, string>(m => m.Status == "Complete, "success class"),
                    Tuple.Create<Func<MyVm, bool>, string, string>(m => m.Status == "Error", "errorclass"),
                });
            })
The issue is GridRow seems to be deprecated in ASP NET Core. I've seen some sugestions to do it client side but I'd like to keep it server side(and extension methods) ifpossible.

Is there a migration guide from MVC5 to ASP.NET Core  regarding the telerik packages or some list with what was deprecated? What's deprecated, what to use in the new version etc ?

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 15 Dec 2022, 04:30 PM

Hello Albert,

It seems to me that the migration of the project on your side also involves a migration from Telerik UI for ASP.NET MVC to Telerik UI for ASP.NET Core.

The MVC's Grid is rendered on the server-side. This enables defining server-side templates.

In contrast the Core Grid is rendered on the client-side and only supports client templates.

That being said we are available, if you'd like to share more details about the requirement at hand to enable us to suggest a possible configuration of the Grid's ClientTemplate.

Regards,
Stoyan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Albert
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Share this question
or