我想用后面的代码(C#)填充下拉列表。我不知道如何得到这个。下面是我目前正在尝试使用的代码,但我收到错误。我试图在商店的下拉列表中填入月份(1 - 12)。用c#代码填充下拉列表
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < 12; i++)
{
DropDownListMonth.SelectedValue = i;
DropDownListMonth.DataTextField = i.ToString();
DropDownListMonth.DataValueField = i.ToString();
}
}
你得到这个代码有什么错误? –