New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior with select #1728

Closed
Knudel opened this Issue Nov 26, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@Knudel

Knudel commented Nov 26, 2018

I have the next code in a server side blazor page:

@page "/"

<select id="test" bind="@selectedval">
    <option value='1'>1</option>
    <option value='2'>2</option>
    <option value='3'>3</option>
    <option value='4'>4</option>
</select>

@functions
{
    [Parameter]
    protected string selectedval { get; set; } = "2";
}

Why is the second value not selected at startup, the selected value is 1?

@vertonghenb

This comment has been minimized.

Contributor

vertonghenb commented Nov 26, 2018

protected string selectedval { get; set; } = "2";
should be an int

@Knudel

This comment has been minimized.

Knudel commented Nov 26, 2018

Thanx @vertonghenb but I believe both should work, but when I change the code into this:

@page "/"

<select id="test" bind="@selectedval">
    <option value='1'>1</option>
    <option value='2'>2</option>
    <option value='3'>3</option>
    <option value='4'>4</option>
</select>

@functions
{
    [Parameter]
    protected int selectedval { get; set; } = 2;

}

It also doesn't work

@SteveSandersonMS

This comment has been minimized.

Member

SteveSandersonMS commented Nov 26, 2018

It's a known issue: #1597

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