问题描述
'重写此方法,确保在程序运行时,指定的GridView控件总是位于<fromrunat="server">标记内PublicOverloadsSubVerifyRenderingInServerForm(ByValcontrolAsControl)EndSub'导出EXCELPublicSubExport(ByValFileTypeAsString,ByValFileNameAsString)Response.Charset="GB2312"Response.ContentEncoding=System.Text.Encoding.UTF7Response.AppendHeader("Content-Disposition","attachment;filename="&HttpUtility.UrlEncode(FileName,Encoding.UTF8).ToString())Response.ContentType=FileTypeEnableViewState=FalseDimtwAsStringWriter=NewStringWriter()DimhwAsHtmlTextWriter=NewHtmlTextWriter(tw)GridViewEx1.RenderControl(hw)Response.Write(tw.ToString())Response.End()EndSubProtectedSubButton5_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesButton5.ClickExport("application/ms-excel","商品信息表.xls")EndSub怎么报错类型“GridViewEx”的控件“GridViewEx1”必须放在具有runat=server的窗体标记内。行127:DimtwAsStringWriter=NewStringWriter()行128:DimhwAsHtmlTextWriter=NewHtmlTextWriter(tw)行129:GridViewEx1.RenderControl(hw)行130:Response.Write(tw.ToString())行131:Response.End()
解决方案
解决方案二:
该回复于2008-05-09 11:09:36被版主删除
解决方案三:
该回复于2008-05-04 10:22:27被版主删除