62,046
社区成员
发帖
与我相关
我的任务
分享
//前台
<asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer Interval="1000" Enabled="false" ID="Timer1" runat="server" OnTick="Timer1_Tick">
</asp:Timer>
<div id="divSubContent" runat="server"></div>
</ContentTemplate>
</asp:UpdatePanel>
//如果后台
protected void Timer1_Tick(object sender, EventArgs e)
{
HtmlGenericControl _div = new HtmlGenericControl();
_div.TagName = "div";
_div.InnerHtml = HttpUtility.HtmlDecode(innertext);
this.divSubContent.Controls.Add(_div);
}
//如果后台
protected void Timer1_Tick(object sender, EventArgs e)
{
this.divSubContent.InnerHtml += innertext;
}
List<HtmlGenericControl> controls = null;
protected void Timer1_Tick(object sender, EventArgs e)
{
controls = Session["controls"] as List<HtmlGenericControl>;
if (null == controls)
{
controls = new List<HtmlGenericControl>();
}
HtmlGenericControl _div = new HtmlGenericControl();
_div.TagName = "div";
_div.InnerHtml = HttpUtility.HtmlDecode(innertext);
controls.Add(_div);
Session["controls"] = controls;
foreach (object c in controls)
{
divSubContent.Controls.Add(c as HtmlGenericControl);
}
}