我不确定在这里做什么,我可能必须使用视图状态,但我需要帮助。
我有一个下拉列表,我不是数据绑定。我会知道我是否应该做一个Page.IsPostBack
而不是数据绑定。
<asp:DropDownList ID="ddlWeeklyWeightIn" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
现在在我后面的代码中我有这个:
protected void Button1_Click(object sender, EventArgs e)
{
string wwin = "";
wwin = ddlWeeklyWeightIn.SelectedItem.Text;
}
在按钮上单击始终为“1”,而不是选定的项目。
谢谢