Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@foreach (var item in new string[] { "AspNetCore","AspNet","SomeJsThingWhatever"})
{
<div>
<input type="radio" name="technology" id="@item" value="@item" @onchange="RadioSelection" checked=@(RadioValue.Equals(item,StringComparison.OrdinalIgnoreCase)) />
<label for="@item">@item</label>
</div>
}
<div>
<label>Selected Value is @RadioValue</label>
</div>
@code
{
string RadioValue = "aspnetcore";
void RadioSelection(ChangeEventArgs args)
{
RadioValue = args.Value.ToString();
}
}
@nsenthilmurugan

This comment has been minimized.

Copy link

@nsenthilmurugan nsenthilmurugan commented Aug 7, 2020

Good Stuff, Keep it up :)

@dodyg

This comment has been minimized.

Copy link

@dodyg dodyg commented Aug 16, 2020

Which SDK is this? The RC one? I can't find the preview 8

@SQL-MisterMagoo

This comment has been minimized.

Copy link
Owner Author

@SQL-MisterMagoo SQL-MisterMagoo commented Aug 16, 2020

Which SDK is this? The RC one? I can't find the preview 8

Sorry that was 0.8 - way before release - I've updated to work on the current released version

@dodyg

This comment has been minimized.

Copy link

@dodyg dodyg commented Aug 16, 2020

The latest version of VS Preview doesn't run .NET 5.0 RC nightly build properly unfortunately :(

@SQL-MisterMagoo

This comment has been minimized.

Copy link
Owner Author

@SQL-MisterMagoo SQL-MisterMagoo commented Aug 16, 2020

Not sure what that had to do with this sample, which will work on the current official release?

@dodyg

This comment has been minimized.

Copy link

@dodyg dodyg commented Aug 16, 2020

Oh ok. I didn't realize Preview 7 (current release) has support InputRadio. Because according to this tweet it's only available on Preview 8.

@SQL-MisterMagoo

This comment has been minimized.

Copy link
Owner Author

@SQL-MisterMagoo SQL-MisterMagoo commented Aug 16, 2020

It doesn't, this sample shows how to use native html radio inputs

@dodyg

This comment has been minimized.

Copy link

@dodyg dodyg commented Aug 16, 2020

ah got it. Thanks.

@coultonluke

This comment has been minimized.

Copy link

@coultonluke coultonluke commented Jan 14, 2021

Beautiful thanks. I don't know why the documentation doesn't work for this but this saved me time thanks!

@cfob

This comment has been minimized.

Copy link

@cfob cfob commented Jan 31, 2021

Only working example I have found. Many thanks.

@0ptim

This comment has been minimized.

Copy link

@0ptim 0ptim commented Jul 30, 2021

Thanks a lot! 💯

@chrisdeveloperit

This comment has been minimized.

Copy link

@chrisdeveloperit chrisdeveloperit commented Aug 20, 2021

Thank you for this! Wish I found it days ago. It should be in the Blazor documentation.

@DesenEnterprises

This comment has been minimized.

Copy link

@DesenEnterprises DesenEnterprises commented Oct 29, 2021

This is awesome, thank you so much! Life saver...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment