rendercontrol类型“Button”的控件“ctl00_Button1”必须放在具有 runat=server 的窗体标记内。

rendercontrol  时间:2021-06-21  阅读:()

Server Error in '/' Application.

不指定的错误 描述: 被不处理的例外在现在的网请求的实行期间发生。

请为关于错误的较多资讯检讨堆叠痕迹,而且它在密码中开始哪里。

例外细节: System.Data.OleDb.OleDbException: 不指定的错误 来源错误: 第 48 行: // 柜台 第 49 行: 串起 _ connStr= ConfigurationManager.AppSettings[" connStr"]+Page.Server.MapPath(".。

t/数据/t.mdb"); 第 50 行: CounterManager counterManager=新的 CounterManager;(_connStr,页) 第 51 行: 第 52 行: 尝试 来源文件: c: website\httpdocsearchdefault.aspx 线: 50 堆叠痕迹: [ OleDbException(0 x80004005): 不指定的错误] System.Data.OleDb.OleDbConnectionInternal。



ctor(OleDbConnectionString constr,OleDbConnection 连接)+1054769 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions 选项, 物体 poolGroupProviderInfo, DbConnectionPool 池,DbConnection owningObject)+53 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection,DbConnectionPoolGroup poolGroup)+27 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)+47 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)+105 System.Data.OleDb.OleDbConnection.Open()+37 simpleCounter.CounterManager.loadTodayCachedList()+146 simpleCounter.CounterManager.loadCache()+240 simpleCounter.CounterManager。



ctor( 线 connString, 页页)+173 ASP.search_default_aspx。

__c: website\httpdocsearchdefault.aspx 的 Render__control1( HtmlTextWriter__w,控制 parameterContainer):50 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter 作家,ICollection 孩子)+2065851 System.Web.UI.Control.RenderChildren(HtmlTextWriter 作家)+24 System.Web.UI.Page.Render(HtmlTextWriter 作家)+26 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter 作家,ControlAdapter 适配器)+25 System.Web.UI.Control.RenderControl(HtmlTextWriter 作家,ControlAdapter 适配器)+121 System.Web.UI.Control.RenderControl(HtmlTextWriter 作家)+22 System.Web.UI.Page.ProcessRequestMain(布尔数学体系的 includeStagesBeforeAsyncPoint,布尔数学体系的 includeStagesAfterAsyncPoint)+1896

asp.net中GridView 数据导出到excel表中怎么弄,说点详细的方法,越具体越好。

引用的别人的: Gridview导出为Excel 尝试了一下Gridview导出为Excel,原本以为很简单,可是真正应用起来还是不太好弄的,呵呵,所想非所得。

总结了一下应该注意下面几点: 1.由于gridview的内容可能是分页显示的,因此,这里在每次导出excel时,先将gridview的allowpaging属性设置为false,然后databind()一下,确保搂到所有数据; 2.不用单独设置导出的路径,导出时会弹出对话框让你确认保存位置; 3.要写一个空的VerifyRenderingInServerForm方法(必须写),以确认在运行时为指定的ASP.NET 服务器控件呈现HtmlForm 控件; 4.导出后别忘记再重新设置其allowpaging属性; 当我把这些都设置好以后,点击[导出],出现了 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render(); ) 的错误,又检查代码,没发现问题啊,搞了一会弄不出来,然后搜索了一下,发现了解决办法: 修改你的aspx文件中的: <%@ Page Language="C#" EnableEventValidation = "false" AutoEventWireup="true" CodeFile="SysUser.aspx.cs" Inherits="Autho_SysUser2" %> 增加红色的部分就ok了。

下面是代码和截图: #region 导出为Excel public override void VerifyRenderingInServerForm(Control control) { // Confirms that an HtmlForm control is rendered for } private void ToExcel(Control ctl, string FileName) { HttpContext.Current.Response.Charset = "UTF-8"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; HttpContext.Current.Response.ContentType = "application/ms-excel"; HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + "" + FileName); ctl.Page.EnableViewState = false; System.IO.StringWriter tw = new System.IO.StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); ctl.RenderControl(hw); HttpContext.Current.Response.Write(tw.ToString()); HttpContext.Current.Response.End(); } private void toExcelClk() { gvSysUser.AllowPaging = false; gvSysUser.AllowSorting = false; gvSysUser.DataBind(); ToExcel(gvSysUser, "OFS_Data.xls"); gvSysUser.AllowPaging = true; gvSysUser.AllowSorting = true; gvSysUser.DataBind(); } #endregion

C# 导入导出Excel

public int DataTabletoExcel(DataGridView tmpDataTable) { if (tmpDataTable.RowCount==0) return 1; try { saveFileDialog1.Filter = "Execl files (*.xls)|*.xls"; saveFileDialog1.FilterIndex = 0; saveFileDialog1.RestoreDirectory = true; saveFileDialog1.Title = "导出文件保存路径"; saveFileDialog1.FileName = null; saveFileDialog1.ShowDialog(); string FileName = saveFileDialog1.FileName; if (FileName != "") { //行数 int rowNum = tmpDataTable.Rows.Count; //列数 int columnNum = tmpDataTable.Columns.Count; int rowIndex = 1; int columnIndex = 0; //new 一个 Microsoft.Office.Interop.Excel 对象 Excel.Application xlApp = new Excel.ApplicationClass(); xlApp.DefaultFilePath = ""; xlApp.DisplayAlerts = true; xlApp.SheetsInNewWorkbook = 1; Excel.Workbook xlBook = xlApp.Workbooks.Add(true); //progressBar1.Visible = true; //将DataTable的列名导入Excel表第一行,表头部分 foreach (DataGridViewColumn dc in tmpDataTable.Columns) { columnIndex++; //给第一行的每个列添加职 xlApp.Cells[rowIndex, columnIndex] = dc.HeaderText; } //将DataTable中的数据导入Excel中 for (int i = 0; i < rowNum; i++) { //给每一行的所有列一次添加值 rowIndex++; columnIndex = 0; for (int j = 0; j < columnNum; j++) { columnIndex++; xlApp.Cells[rowIndex, columnIndex] = tmpDataTable[j, i].Value; } //progressBar1.Value += 100 / rowNum; } xlBook.SaveCopyAs(FileName); MessageBox.Show("数据已经成功导出到:" + saveFileDialog1.FileName.ToString(), "导出完成", MessageBoxButtons.OK, MessageBoxIcon.Information); //progressBar1.Value = 0; //progressBar1.Visible = false; } return 0; } catch (System.Exception) { return 2; } } 自己拖个openFileDialog1控件,稍微改下就可以了

类型“Button”的控件“ctl00_Button1”必须放在具有 runat=server 的窗体标记内。

淡定,小问题。

第一个情况,你ctl00_Button1没有增加服务器属性。

把你的页面的ctl00_Button1的标签内增加一个属性就行。

runat=server 。

如果上述情况不存在,你进行我的下一个步骤。

看看你的from标签,是不是有runat=server 这个属性,如果没有,放进去,OK,问题搞定。

有问题再追问。

ZoeCloud:香港BGP云服务器,1GB内存/20GB SSD空间/2TB流量/500Mbps/KVM,32元/月

zoecloud怎么样?zoecloud是一家国人商家,5月成立,暂时主要提供香港BGP KVM VPS,线路为AS41378,并有首发永久8折优惠:HKBGP20OFF。目前,解锁香港区 Netflix、Youtube Premium ,但不保证一直解锁,谢绝以不是原生 IP 理由退款。不保证中国大陆连接速度,建议移动中转使用,配合广州移动食用效果更佳。点击进入:zoecloud官方网站地址zo...

RAKsmart 2021新年新增韩国服务器及香港美国日本VPS半价

RAKsmart 商家我们肯定不算陌生,目前主要的营销客户群肯定是我们。于是在去年的时候有新增很多很多的机房,比如也有测试过的日本、香港、美国机房,这不今年有新增韩国机房(记得去年是不是也有增加过)。且如果没有记错的话,之前VPS主机也有一次磁盘故障的问题。 这不今天有看到商家新增韩国服务器产品,当然目前我还不清楚商家韩国服务器的线路和速度情况,后面我搞一台测试机进行...

老薛主机VPS年付345元,活动进行时。

老薛主机,虽然是第一次分享这个商家的信息,但是这个商家实际上也有存在有一些年头。看到商家有在进行夏季促销,比如我们很多网友可能有需要的香港VPS主机季度及以上可以半价优惠,如果有在选择不同主机商的香港机房的可以看看老薛主机商家的香港VPS。如果没有记错的话,早年这个商家是主营个人网站虚拟主机业务的,还算不错在异常激烈的市场中生存到现在,应该算是在众多商家中早期积累到一定的用户群的,主打小众个人网站...

rendercontrol为你推荐
滚动条样式修改在css中怎样改变滚动条的样式ico监管新加坡代币ICO备案怎么做excel大写金额怎么用Excel将小写金额转换成人民币的大写金额公众号付费阅读为什么微信公众号阅读要收费?5e5e5e如何更改bootstrap navbar的颜色 03 Topics 03 Ruby Chinashoujiao求【叫兽】的简介网络安全密钥网络安全密钥和wifi密码有什么区别医院排队系统医院排队机和医院排队机的区别有哪些?防火墙技术应用常用防火墙技术有哪几种空间导航QQ空间中如何自定义导航?
上海域名注册 域名注册使用godaddy 泛域名绑定 lunarpages 主机点评 godaddy主机 香港托管 英文简历模板word iis安装教程 国外网站代理服务器 湖南服务器托管 数字域名 美国网站服务器 域名dns 国外的代理服务器 阿里云手机官网 阿里dns 攻击服务器 七十九刀 新疆服务器 更多