mko
mko

Reputation: 7325

Does Blazor client-side support code behind?

I am trying to find a way to move @code from a blazor page to a code behind page.

I tried to add blazorPage.razors.cs and followed instruction from

https://www.telerik.com/blogs/using-a-code-behind-approach-to-blazor-components

I also found an article

https://visualstudiomagazine.com/articles/2019/10/17/aspnet-core-updates.aspx

that actually provides this functionality in asp.net core 3.1

So if I got it correcly partial class and code behind is not possible with asp.net core 3.0 and client side blazor?

Upvotes: 0

Views: 186

Answers (1)

Mike Brind
Mike Brind

Reputation: 30110

The partial class approach to Razor component "code-behind" files was introduced in 3.1.0 preview 1. Prior to that (i.e 3.0), you need to explicitly inherit from your code behind class as in the Telerik blog you referenced.

Upvotes: 3

Related Questions