Blazor - How to set value from childcontent property

蓝咒 提交于 2020-12-15 05:14:07

问题


How to set value from childcontent property

index.razor

  <ButtonName>Submit</ButtonName>

ButtonName.razor

<input type="radio" value=@childContent>
<label> @childContent </label>

回答1:


You should define a parameter property named ChildContent in ButtonName.razor, like this:

[Parameter]
 public RenderFragment ChildContent { get; set; }

And use it like this:

<input type="radio" value=@ChildContent>
<label> @ChildContent </label>

Note that ChildContent contains initial capital letter C



来源:https://stackoverflow.com/questions/64715699/blazor-how-to-set-value-from-childcontent-property

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!