I have an .aspx page which contains two <asp:DropDownList>
controls which are filled with static items like so:
<asp:DropDownList ID="ddl1" ...>
<asp:ListItem Value="A" Text="..." />
<asp:ListItem Value="B" Text="..." />
....
<asp:ListItem Value="X" Text="..." />
</asp:DropDownList>
.....
<asp:DropDownList ID="ddl2" ...>
<asp:ListItem Value="A" Text="..." />
<asp:ListItem Value="B" Text="..." />
....
<asp:ListItem Value="X" Text="..." />
</asp:DropDownList>
The list items for ddl1
and ddl2
are the same. As such, I would like to reuse them and remove the duplication.
I could fill the combos in the code behind .aspx.cs but I really don't want to have some dumb data in there filling plain combos. I just want the logic of the page there.
Is there a way to resue the list items inside the .aspx?