0
On my client’s website, I have a dropdown list with the months of the year. Unfortunately, the value property has months written instead of numbers.
<asp:DropDownList ID="ddlMesReajuste" runat="server" AppendDataBoundItems="true">
<asp:ListItem Value="" Text="Selecione o mês de reajuste" Selected></asp:ListItem>
<asp:ListItem Value="Janeiro" Text="Janeiro"></asp:ListItem>
<asp:ListItem Value="Fevereiro" Text="Fevereiro"></asp:ListItem>
<asp:ListItem Value="Março" Text="Março"></asp:ListItem>
<asp:ListItem Value="Abril" Text="Abril"></asp:ListItem>
<asp:ListItem Value="Maio" Text="Maio"></asp:ListItem>
<asp:ListItem Value="Junho" Text="Junho"></asp:ListItem>
<asp:ListItem Value="Julho" Text="Julho"></asp:ListItem>
<asp:ListItem Value="Agosto" Text="Agosto"></asp:ListItem>
<asp:ListItem Value="Setembro" Text="Setembro"></asp:ListItem>
<asp:ListItem Value="Outubro" Text="Outubro"></asp:ListItem>
<asp:ListItem Value="Novembro" Text="Novembro"></asp:ListItem>
<asp:ListItem Value="Dezembro" Text="Dezembro"></asp:ListItem>
</asp:DropDownList>
I needed this Dropdown to "disappear" with some options of months. For example, today is day 21/6. Then I should only have access to the options from August onwards. But when it passes 10/7, then I would have access to the options from September onwards.
That is, the options are always from the following month onwards (if we are before the 11th of the current month) and two months after the current one if we are from the 11th until the last day of the current month.
Of course, for November, you’d only have December if we were before 11/11. And for December, every month would be available, except for January if it was 11/1.
I know it seems a little complicated, but I was wondering how to do something about it because it is not possible to put ID on the Listitems and also because the Values of the items are written months.
What I could do?
Perfect, it worked great here. Thank you!!!
– Gustavo Hoppe Levin