Skip to content

Instantly share code, notes, and snippets.

@SQL-MisterMagoo
Last active October 31, 2021 18:35
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SQL-MisterMagoo/bc5713fb26bf84bf810d48d1f45c361a to your computer and use it in GitHub Desktop.
Save SQL-MisterMagoo/bc5713fb26bf84bf810d48d1f45c361a to your computer and use it in GitHub Desktop.
@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
Copy link

Good Stuff, Keep it up :)

@dodyg
Copy link

dodyg commented Aug 16, 2020

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

@SQL-MisterMagoo
Copy link
Author

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
Copy link

dodyg commented Aug 16, 2020

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

@SQL-MisterMagoo
Copy link
Author

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

@dodyg
Copy link

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
Copy link
Author

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

@dodyg
Copy link

dodyg commented Aug 16, 2020

ah got it. Thanks.

@coultonluke
Copy link

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

@cfob
Copy link

cfob commented Jan 31, 2021

Only working example I have found. Many thanks.

@0ptim
Copy link

0ptim commented Jul 30, 2021

Thanks a lot! 💯

@chrisdeveloperit
Copy link

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

@DesenEnterprises
Copy link

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