I have the following cshtml page:
@inheritsBlazorLayoutComponent<NavMenuToggleComponent></NavMenuToggleComponent><div class="main"><div class="top-row px-4"><a href="http://blazor.net" target="_blank"class="ml-md-auto"><span class="col-md-1">About</span></a><NavLinkclass="nav-link pull-right col-md-2" id="logout" href="logout"><span class="fas fa-sign-out-alt" aria-hidden="true"></span><span class="col-md-1 pull-right">Logout</span></NavLink></div><div class="content px-4">@Body</div>
as you can see I have a component called NavMenuToggleComponent who's code is:
@inheritsBlazor.Web.Functions.MenuFunctions<div class="pl-4 navbar navbar-dark"><button class="navbar-toggler navbar-brand main-button" title="MENU" onclick=@ToggleNavMenu>
MENU</button></div><div class="sidebar @(CollapseNavMenu ? "collapse" : null)"><NavMenu/></div>
I have a function on the button click event and this is declared in the MenuFunctions Class. This, function simply has :
public class MenuFunctions : BlazorComponent
{
publicvoidToggleNavMenu() {CollapseNavMenu=!CollapseNavMenu; }…..
Now to keep it simple from this function I want to be able to add an attribute to the element on the parent that has the class content on it. so as an example I might want this to end up as<div class="content px-4" style="color:red">
so How would I attach the style attribute? The one caveat that also makes this more difficult is that I am not allowed to embed any `@functions` In my .cshtml page, hence
my MenuFunctions class