求帮助!Timer与foreach的问题。
点击开始发送,执行Timer1_Tick
前台无刷新显示:总数,发送成功数,和失败数,
现在的代码只能显示最后的结果,无法动态逐条显示。
/////aspx代码/////
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
总数量:<asp:Label ID="sum" runat="server" Text=""></asp:Label>条,成功发送:<asp:Label ID="success" runat="server" Text=""></asp:Label>,发送失败:<asp:Label ID="failure" runat="server" Text=""></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button2" runat="server"
Text="开始发送" onclick="StartSend_Click" />
///////////////////// cs代码////////////////
SendMail sm = new SendMail();
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
Timer1.Enabled = false;
string dz = Request["dz"];
string fwq = Request["fwq"];
string content = Request["content"];
msmodel = msbll.GetModel(int.Parse(fwq)); //获取服务器信息
codemodel = codebll.GetModel(int.Parse(content)); //获取发送内容文件地址
string contentbody = MailContentBind(codemodel.Dzqk_content);//获取发送内容
}
sum.Text = sum_num.ToString();
success.Text = success_num.ToString();
failure.Text = failure_num.ToString();
}
protected void StartSend_Click(object sender, EventArgs e)
{
Timer1.Enabled = true; //开始发送
}
protected void Timer1_Tick(object sender, EventArgs e)
&