Replies: 2 comments 1 reply
-
Same here, I also tested the @OnClick event on the button (ie DropDownItem) and the events are not firing. I see there were changes to the drop-down in release 3. Was this broken? I have lost confidence in my reasoning abilities on this one. Maybe we are doing something wrong? |
Beta Was this translation helpful? Give feedback.
-
@rosunad it seems that "Dropdown" in Bootstrap terms is not a dropdown select as we would have expected it to be. A Bootstrap dropdown is a button or link that, when clicked, reveals a list of links or actions. This is not the same as a form element ( So you would need to go to bare Bootstrap CSS, something like this: @page "/example"
<h3>My Blazor Component</h3>
<select class="form-select" @onchange="HandleSelectChange">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
@code {
private void HandleSelectChange(ChangeEventArgs e)
{
var value = e.Value.ToString();
Console.WriteLine($"Selected value: {value}");
}
} I just use the default blazor 'InputSelect' control and set the class styling to 'form-select' <InputSelect class="form-select" @onchange="HandleSelectChange">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</InputSelect > |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
There must be something I'm completely ignoring. I can't get a change event to be triggered when I select an item from the dropdown. what am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions