asp.net弹出消息框后为什么会跳出循环
string Wkid = Request.QueryString["id"];
DateTime now = DateTime.Now;
DateTime d1 = new DateTime(now.Year, now.Month, 1);
int c = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
for (int i = 0; i < c; i++)
{
string j = d1.AddDays(i).toFormatShortDate();
ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.Page.GetType(), " btn_check", "alert ('这个月还没安排的日期:" + j + "');", true);
}
[解决办法]
[解决办法]
应该这样来做:
StringBuilder sb = new StringBuilder();
for (int i = 0; i < c; i++)
{
string j = d1.AddDays(i).toFormatShortDate();
sb.Append("alert ('这个月还没安排的日期:" + j + "');");
}
ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.Page.GetType(), " btn_check", sb.ToString(), true);
[解决办法]