I've got 2 dropdowns that are not 'dropping down' on the page. When either one is clicked it does this
It's hard to see, but there is a second line under the dropdown box and that's it. Happens like this on either dropdown.
The code for the dropdowns is:
<div>
<label class="mr-3">Select Start Month/Year</label>
<RadzenDropDown Value="FNMnth" Placeholder="Select Month" Data="@Months"
TValue="string" TextProperty="MnthNum" ValueProperty="MnthName"
Change="@(args => ChangeMnth(args))">
</RadzenDropDown>
<RadzenDropDown Value="FNYr" Placeholder="Select Year" Data="@Years"
TValue="string" TextProperty="YrNum" ValueProperty="YrName"
Change="@(args => ChangeYr(args))">
</RadzenDropDown>
<label class="mr-3">Set Padding days</label>
<RadzenTextBox id="txtPadDays" Placeholder="Days past last day of Month" @bind-Value=@PadDays></RadzenTextBox>
<RadzenButton ButtonType="ButtonType.Button" ButtonStyle="ButtonStyle.Primary"
Text="Fetch Report" Click=@(args => GetRpt(args))></RadzenButton>
</div>
with the code behind as:
int FNMnth = 0;
string FNYr = "";
string PadDays = "";
public class MnthList
{
public int MnthNum { get; set; }
public string? MnthName { get; set; }
}
public class YrList
{
public int YrNum { get; set; }
public string? YrName { get; set; }
}
IList<MnthList>? Months = new List<MnthList>();
IList<YrList>? Years = new List<YrList>();
protected override void OnInitialized()
{
IList<MnthList> Months = new List<MnthList>();
for(int i = 1; i < 13; i++)
{
MnthList ml = new MnthList();
ml.MnthNum = i;
ml.MnthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i);
Months.Add(ml);
}
Console.WriteLine("Month list = " + Months.Count.ToString()); // prints Months list = 3
IList<YrList>? Years = new List<YrList>();
YrList yl = new YrList();
int yr = 2021;
int thisyear = DateTime.Now.Year;
int j = 0;
while (thisyear >= yr)
{
yl.YrNum = j;
yl.YrName = thisyear.ToString();
Years.Add(yl);
thisyear = thisyear - 1;
j = j + 1;
}
Console.WriteLine("Year List = " + Years.Count.ToString()); //prints "Year List = 3
}