Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Bootstrap radio button group

$
0
0

I'm creating a form in Blazor and I like to have a segment like the following example

enter image description here

Using Bootstrap, I have this code for that

<div class="btn-group" role="group" aria-label="Basic radio toggle button group"><input type="radio" id="btnradio1-@Id" class="btn-check" name="btnradio1-@Id"         autocomplete="off" checked @bind-value="Value"><label class="form-label btn btn-outline-primary" for="btnradio1-@Id">        Yes</label><input type="radio" id="btnradio2-@Id" class="btn-check" name="btnradio2-@Id"         autocomplete="off" @bind-value="Value"><label class="form-label btn btn-outline-primary" for="btnradio2-@Id">        No</label><input type="radio" id="btnradio3-@Id" class="btn-check" name="btnradio3-@Id"         autocomplete="off" @bind-value="Value"><label class="form-label btn btn-outline-primary" for="btnradio3-@Id">        Sometimes</label></div>

and in the code, I have this parameter:

[Parameter] public string Id { get; set; } = Guid.NewGuid().ToString();[Parameter] public string? Value { get; set; }

When I click on an input, I want to change the Value with the correspond value of the input I clicked. For example, if I click on No, I want that the Value is No.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>