protected void Rp_CompanyList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "DownLoad")
{
id = e.CommandArgument.ToString();
if (id == "" || id == null)
{
Response.Write("<script>alert('编号为空,不可下载!')");
return;
}
try
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(id + ".csv"));
Response.WriteFile(Server.MapPath("DownLoad/" + id + ".csv"));
Response.End();
}
catch (Exception error)
{
Response.Write("<script>alert('" + error.ToString() + "')");
}
}
}为什么异常跳不出来啊?急 急 急 急
{
if (e.CommandName == "DownLoad")
{
id = e.CommandArgument.ToString();
if (id == "" || id == null)
{
Response.Write("<script>alert('编号为空,不可下载!')");
return;
}
try
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(id + ".csv"));
Response.WriteFile(Server.MapPath("DownLoad/" + id + ".csv"));
Response.End();
}
catch (Exception error)
{
Response.Write("<script>alert('" + error.ToString() + "')");
}
}
}为什么异常跳不出来啊?急 急 急 急
大哥啊,你闭合啊 </script>
Response.Write("<script>alert('" + error.ToString() + "')</script>");