第三方控件引起的"未将对象引用设置到对象的实例" AutoVueX控件,一个显示好多种文件格式的控件,出现错误是随机的,好像是控件试用期已过,但用VB还有delphi调用该控件都是正常的,很奇怪... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢各位,直接调用控件还是没解决,用的曲线救国的方式,用VB调用控件编译成可执行程序,然后用C#调用该外部文件,传递参数. 你在.cs文件中加入下面这个函数:public void ToExcel(System.Web.UI.Control ctl) { // HttpContext.Current.Response.Charset ="GB2312"; HttpContext.Current.Response.Charset =""; HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=money.xls"); HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.GetEncoding("GB2312"); HttpContext.Current.Response.ContentType ="application/ms-excel";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword ctl.Page.EnableViewState =false; System.IO.StringWriter tw = new System.IO.StringWriter() ; System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (tw); ctl.RenderControl(hw); HttpContext.Current.Response.Write(tw.ToString()); HttpContext.Current.Response.End(); }然后再调用:ToExcel(datagrid1) php翻译至c#的错误 多客户机的对应? VS2005是不是没有ColorPicker这样的下拉式的颜色选择器? 谁有winforms的OA啊给小弟一个啊!!! ★★★★100分求助,C#中,数据库已经连接,如何返回数据库表中的记录集?----★★★★ 我是一个菜鸟,救命呀 DataRowCollection? 帮我编辑这个程序有什么问题。 谁能将这段代码分离为aspx和cs代码 我在vs环境运行任何程序都出现“传递到系统调用的数据区太小”这个错误,而不能运行。请问是怎么回事。 寻求在武汉的用C#开发MIS系统的有过项目经理经验的高手 如何提升程序的权限(在线等待)
你在.cs文件中加入下面这个函数:public void ToExcel(System.Web.UI.Control ctl)
{
// HttpContext.Current.Response.Charset ="GB2312";
HttpContext.Current.Response.Charset ="";
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=money.xls");
HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.ContentType ="application/ms-excel";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword
ctl.Page.EnableViewState =false;
System.IO.StringWriter tw = new System.IO.StringWriter() ;
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}然后再调用:ToExcel(datagrid1)