国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

asp.net上傳execl文件后、,在頁面上加載顯示

2019-11-02 15:40:59
字體:
來源:轉載
供稿:網友

 本篇文章主要是對asp.net上傳execl文件后,在頁面上加載顯示(示例代碼)進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

 代碼如下:    #region 上傳Execl文件    protected void Button1_Click(object sender, EventArgs e)    {        if (FileUpload1.HasFile)        {            string NewFileName = string.Empty;            string ErrorMess = UpLoadFile(FileUpload1, ".xls|.xlsx", 1024 * 5, Server.MapPath("/Report/SocialApply/"), 1, out NewFileName);            if (string.IsNullOrEmpty(ErrorMess))            {                Label1.Text = "√文件上傳成功";                ViewState["UpLoadFile"] = "/Report/SocialApply/" + NewFileName;                try                {                    FileStream file = new FileStream                        (Server.MapPath(ViewState["UpLoadFile"] as string),                        FileMode.Open, FileAccess.Read,                        FileShare.ReadWrite);                    DataTable dt1 = FairHR.Util.XmlExcelReport.ReadExcelToDataTable(file, 0, 0);                     ViewState.Add("ViewDT", dt1);                    GridView1.DataSource = ViewState["ViewDT"] as DataTable;                    GridView1.DataBind();                    file.Close();                    //Maticsoft.Common.MessageBox.ResponseScript(Page, "$.messager.alert('系統提示', '操作成功!', 'info');");                }                catch                {                    Maticsoft.Common.MessageBox.ResponseScript(Page, "$.messager.alert('系統提示', '請重新上傳Execl文件再操作', 'warning');");                }            }            else            {                Label1.Text = "×文件上傳失敗";            }        }        else        {            Label1.Text = "×請先選擇上傳文件";        }        ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "idAlert1", "closeLoad();", true);    }    #endregion     #region 上傳文件    /// <summary>    /// 上傳文件    /// </summary>    /// <param name="fu">上傳文件</param>    /// <param name="type">上傳
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 天长市| 大城县| 合江县| 宜宾市| 敦化市| 晋江市| 怀安县| 湘潭县| 鄂伦春自治旗| 保德县| 日喀则市| 黎城县| 盐亭县| 许昌县| 洛宁县| 安泽县| 云梦县| 方山县| 平舆县| 凤翔县| 包头市| 政和县| 宣恩县| 香格里拉县| 旬阳县| 农安县| 江山市| 临清市| 渭源县| 城口县| 绥江县| 抚顺市| 灵石县| 庆阳市| 商丘市| 玉林市| 铜梁县| 萍乡市| 赣州市| 绥宁县| 西华县|