C#学习教程:Doc文件不从asp.net中的UserControl下载有一个列候选名称和一个模板字段链接按钮。我附加了一个rowcommand事件,我正在下载一个word文件。我有下载文档文件的代码,可以从简单的网页下载我的文档文件,但这段代码不能用于用户控制。谁能帮我解决这个问题。它提供错误响应不可用CandidateNameprotectedvoidgrdCandidate_RowCommand(objectsender,GridViewCommandEventArgse){try{if(e.CommandName=="Download"){byte[]Attachment=null;字符串扩展名=string.Empty;字符串简历=“简历”;ClsCandidateManagerobjCandidateManager=newClsCandidateManager();ClsSecureManagerobjSecureManager=newClsSecureManager();附件=objCandidateManager.GetCandidateAttachment(Convert.ToInt32(e.CommandArgument),扩展名);if(Attachment!=null&&Attachment.Length>0){尝试{Response.Clear();Response.Buffer=true;Response.Charset="";if(Extension==".pdf"){Response.ContentType="application/pdf";}else{Response.ContentType="application/vsd-msword";}Response.AddHeader("content-disposition","attachment;filename="+Resume+扩展);Response.Cache.SetCacheability(HttpCacheability.NoCache);Response.BinaryWrite(附件);响应.Flush();响应.End();}catch(Exceptionex){stringstr=ex.Message+ex.内部异常;}}else{//ClientScript.RegisterStartupScript(typeof(Page),"SymbolError","alert('简历未上传!');");}}}catch(Exceptionex){stringstr=ex.消息+ex.InnerException;}使用UpdatePanel,如下图,以上是C#学习教程:Doc文件不是从asp.net中的UserControl下载的,分享所有内容,如果对大家有用还需要进一步了解C#学习教程,希望大家多多关注——'>本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处: