Closed
Description
In the following example, the initial value of currentServer
is not bound to the select tag.
And if I specify select="selected"
in one option, then it's not reflected in the variable.
It works when I change the variable by code, or when the selection is changed.
Sample:
<p>Current server: @currentServer</p>
<div class="form-group">
<select class="form-control" bind="@currentServer">
<option value="WindowsPhysical">Windows - Physical</option>
<option value="LinuxPhysical">Linux - Physical</option>
<option value="WindowsCloud">Windows - Cloud</option>
<option value="LinuxCloud">Linux - Cloud</option>
</select>
</div>
<button class="btn btn-primary" onclick="@RunJob">Run</button>
@functions {
string currentServer = "LinuxCloud";
void RunJob()
{
currentServer = "WindowsCloud";
}
}