Use section content for Splitter.Content() with RenderSection() .NET6

1 Answer 26 Views
Splitter
Kevin
Top achievements
Rank 1
Kevin asked on 22 Jul 2022, 01:18 AM

I'm working in a migration to MVC .NET6 from .NET Framework, so in the Layout we use the following

@Html.Kendo().Splitter().Name("Splitter").Panes(p => {
p.Add().Content(RenderSection("Header", true).ToHtmlString());
p.Add().Content(RenderSection("Content", true).ToHtmlString());
});

As you can see we are using RenderSection() to take the HTML defined in other view. For each page we have the following code

But in .NET6 the same RenderSection() renders the content of the section. (has other behaviour)

There is other way to get the HTML from the sections?

 

Version: Telerik.UI.for.AspNet.Core.2020.2.513

MVC

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 26 Jul 2022, 12:50 PM

Hi Kevin,

I noticed that there is not a Telerik UI for ASP.NET Core license associated with your account which limits the availability of our support services for the product. In this regard, It is recommended that you either purchase or renew your license in order to gain access to the latest updates, fixes, features, and support regarding the Telerik UI for ASP.NET Core components. More information regarding the currently available plans can be reviewed here:

With that being said, rendering the content of the Telerik UI for ASP.NET Core Splitter is not supported out-of-the-box. Having this in mind, if you wish to set the content of the panes, I would recommend using either of the options listed in the following documentation:

Kind Regards,
Alexander
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Alexander
Telerik team
commented on 27 Jul 2022, 02:31 PM

Hi Kevin,

A duplicate of a support ticket relevant to the topic was opened recently where I have investigated the matter more thoroughly. I am posting my findings here so that members of the community can benefit from the information as well. 

"Upon further investigation, one possible approach would be to utilize the .Render() method to wrap the component declaration in a non-rendering code block with @{} instead of @(). Here is an example":

@{Html.Kendo().Splitter().Name("Splitter").Panes(p =>
	{
		p.Add().Content(@<text>@RenderSection("mySection", true)</text>);
		p.Add().Content(@<text>@RenderSection("mySection2", true)</text>);
	}).Render();
}

"With that being said, I cannot confirm with complete certainty whether the provided approach would have any future drawbacks. Nevertheless, here is a runnable sample that illustrates this approach in .NET 6."

Tags
Splitter
Asked by
Kevin
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or