`
<select class="form-select" id="financialYears" onchange="preventAutopostBack(event)">
@{
// Get the current year
var currentYear = 2024;
// Generate options for the last 5 years dynamically
for (int i = 0; i < 20; i++)
{
var startYear = currentYear - i;
var endYear = startYear + 1;
var financialYear = $"{startYear}-{endYear}";
if (i == 0) // Check if it's the first option (current year)
{
<option value="@financialYear" selected>@financialYear</option>
}
else
{
<option value="@financialYear">@financialYear</option>
}
}
}
</select>`
how to stop autopost back on dropdown selection in dotnet core application and i use jquery and javascript with it is not working at all