2008-11-26 4 views

Répondre

2
<asp:DropDownList ID="DropDownList1" runat="server"> 
</asp:DropDownList> 

for (int i = 0; i < 3; i++) 
{ 
    ListItem item = new ListItem(string.Format("{0: MM/yyyy}", DateTime.Now.AddMonths(-i))); 
    DropDownList1.Items.Add(item); 
} 

Try this :)

1

Vous pouvez aussi créer un sujet de requête avec SQL comme cet exemple Oracle:

SELECT to_char(add_months(SYSDATE, -1 * LEVEL + 1), 'MMYYYY') AS mon 
FROM dual 
CONNECT BY rownum < 4