protected void lnkDownLoad_Click(object sender, EventArgs e)
    {

        KeFu.BLL.tbl_Dealer_Kefu kefuBll = new KeFu.BLL.tbl_Dealer_Kefu();
        DataSet data = kefuBll.GetList("  iId =7");
        //下载work文档

        if (data.Tables[0].Rows[0]["OtherContent"].ToString().Length > 0)
        {

            DataRow dr = (DataRow)data.Tables[0].Rows[0];
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = dr["OtherContent"].ToString();
            Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(dr["OtherContent"].ToString()));
            Response.WriteFile("File\\" + dr["OtherContent"].ToString());//取得相对路径
            Response.Flush();
            Response.End();
        }
        else
        {
            MessegeBox.Show(this, "无上传文档");
        }
    }

posted on 2008-05-19 14:38  星答  阅读(242)  评论(0编辑  收藏  举报