Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

blazor option selected

<select value="@SelectedYear" @onchange="ChangeYear">
    @for (int i = 2015; i < DateTime.Now.Year + 1; i++)
    {
        <option value="@i">@i</option>
    }
</select>

<p>@SelectedYear</p>

@code
 {
    private int SelectedYear { get; set; } = 2018;

    void ChangeYear(ChangeEventArgs e)
    {
        SelectedYear = Convert.ToInt32(e.Value.ToString());

    }
}
Comment

blazor option selected


<select value="@SelectedYear" @onchange="ChangeYear">
    @for (int i = 2015; i < DateTime.Now.Year + 1; i++)
    {
        <option value="@i">@i</option>
    }
</select>

<p>@SelectedYear</p>

@code
 {
    private int SelectedYear { get; set; } = 2018;

    void ChangeYear(ChangeEventArgs e)
    {
        SelectedYear = Convert.ToInt32(e.Value.ToString());

    }
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: loop through all enum values in C# 
Csharp :: c# convert object to string 
Csharp :: dart extending list 
Csharp :: c# encrypt decrypt string 
Csharp :: check distance to gameobject 
Csharp :: unity json save array 
Csharp :: c# dictionary first 
Csharp :: bootstrap modal 
Csharp :: c# iterate over a dictionary 
Csharp :: google sheets sum if check contains string 
Csharp :: unity how to get the first word from string 
Csharp :: c# convert string to int 
Csharp :: c# find one object in list where 
Csharp :: milliseconds to seconds c# 
Csharp :: c# loop through files in folder 
Csharp :: how to save a c# dictionary 
Csharp :: c# how to refresh your binding source 
Csharp :: unity hide mesh 
Csharp :: C# .net core convert string to enum 
Csharp :: how to get the width of the screen C# 
Csharp :: c# write variable in string 
Csharp :: selenium open chrome c# 
Csharp :: how to print dictionary in c# 
Csharp :: c# multiply string 
Csharp :: instantiate list with values c# 
Csharp :: c# unity detect any keyboard input 
Csharp :: how to instantiate a gameobject 
Csharp :: google sheet script change text color 
Csharp :: dynamic arrays in c# 
Csharp :: c# datetime format ymd 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =