RadioButtonList不刷新static变量问题
有一个radiobutton,通过选择2个按钮,来设置一个static变量为不同的值,做AB不同的操作。
调试运行都正常,但是在发布了一段时间之后,出现了即使点选第二个,页面有刷新动作,static变量的值仍然为第一个,做的是A操作。
开始重启IIS之后就好了,后来重启IIS多次也不管用。
求高手指点,谢谢!!
页面
<asp:RadioButtonList ID="QueryStyle" AutoPostBack ="true" OnSelectedIndexChanged="QueryStyleChanged" RepeatLayout="flow" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Selected="True" Text="************ " />
<asp:ListItem Selected="False" Text="**********8 " />
</asp:RadioButtonList>
程序里
static int style;
protected void QueryStyleChanged(object sender, EventArgs e)
{
style = QueryStyle.SelectedIndex;
if (style == 0)
DO A
else
DO B
}