본문 바로가기
SoftWare/ASP.net Core Blazor

[ASP.NET Blazor] <select> Element onchange event

by 학수씨 2020. 8. 22.
<select name="job" @onchange="DoStuff">
    <option value="">직업선택</option>
    <option value="학생">학생</option>
    <option value="회사원">회사원</option>
    <option value="기타">기타</option>
</select>
@code {
    string selectedString = "";
    void DoStuff(ChangeEventArgs e)
    {
        selectedString = e.Value.ToString();
        Console.WriteLine(selectedString);
    }
}

 

댓글