Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 服务器错误:无法修改控件集合,因为该控件包含代码块(即,<;%…%>;)_C#_Asp.net_Code Behind_Web Controls - Fatal编程技术网

C# 服务器错误:无法修改控件集合,因为该控件包含代码块(即,<;%…%>;)

C# 服务器错误:无法修改控件集合,因为该控件包含代码块(即,<;%…%>;),c#,asp.net,code-behind,web-controls,C#,Asp.net,Code Behind,Web Controls,我要添加的控件和控件本身都不包含或块。为什么我会得到这个?下面是我在图表页面中的代码,该页面包含有问题的行(用注释标记),charts.asx.cs: 使用系统; 使用System.Collections.Generic; 使用系统数据; 使用System.IO; 使用System.Linq; 使用System.Web; 使用System.Web.UI; 使用System.Web.UI.WebControl; 使用Telerik.Web.UI; 命名空间DashboardX.pages { 公共

我要添加的控件和控件本身都不包含
块。为什么我会得到这个?下面是我在图表页面中的代码,该页面包含有问题的行(用注释标记),
charts.asx.cs

使用系统;
使用System.Collections.Generic;
使用系统数据;
使用System.IO;
使用System.Linq;
使用System.Web;
使用System.Web.UI;
使用System.Web.UI.WebControl;
使用Telerik.Web.UI;
命名空间DashboardX.pages
{
公共部分类图表:System.Web.UI.UserControl
{
受保护的无效页_Init(对象发送方,事件参数e)
{
//问题就在这里!!!
占位符1.控件.添加(ColumnPanel);
}
受保护的无效页面加载(对象发送方、事件参数e)
{
数据绑定();
}
public void DownloadColumnChart(对象发送者,事件参数e)
{
下载图像(发送方、e、RadHtmlChart1、DropDownList1);
}
public void DownloadPieChart(对象发送者,事件参数e)
{
下载图像(发送方、e、RadHtmlChart2、DropDownList2);
}
public void DownloadBarChart(对象发送者,事件参数e)
{
下载图像(发送方、e、RadHtmlChart3、DropDownList3);
}
public void DownloadLineChart(对象发送者,事件参数e)
{
下载图像(发送方、e、RadHtmlChart4、DropDownList4);
}
/// 
///下载给定RadHtmlChart的图像(带有给定的下拉列表
///通过启动Inkscape和
///传递一些命令行参数。
/// 
///谁运行这个函数?
///事件数据。
///要生成图像的图表。
///选择了所需格式的下拉列表。
public void DownloadImage(对象发送方、事件参数e、RadHtmlChart图表、DropDownList ddl)
{
//获取导出图表所需的设置
HtmlChartExportSettings currentSettings=新的HtmlChartExportSettings();
if(chart.Height!=null和&chart.Width!=null)
{
currentSettings.Height=(int)chart.Height.Value;
currentSettings.Width=(int)chart.Width.Value;
}
//解码从客户端保存的SVG字符串
字符串svgText=HttpUtility.UrlDecode(svgHolder.Value);
//创建Inkscape将使用的临时SVG文件
currentSettings.SvgFilePath=Server.MapPath(“~/App_Data/temp.svg”);
System.IO.File.WriteAllText(currentSettings.SvgFilePath,svgText);
//获取导出格式-png或pdf
currentSettings.Extension=ddl.SelectedValue;
//Inkscape将使用输出文件,硬编码为将App_数据用作临时文件夹
currentSettings.OutputFilePath=(@“C:\chart.+currentSettings.Extension);
//您可以更改用户将在此处接收的文件名。扩展名将自动添加
currentSettings.ClientFileName=“图表”;
//实际文件已创建
HtmlChartExporter.ExportHtmlChart(当前设置);
//读取导出的文件并将其发送到客户端
字节[]fileForClient=HtmlChartExporter.ReadFile(currentSettings.OutputFilePath);
Response.ContentType=HtmlChartExportSettings.ContentTypeList[currentSettings.Extension];
Response.AddHeader(“内容处置”、“附件;文件名=“+currentSettings.ClientFileName”);
BinaryWrite(fileForClient);
//删除临时文件以避免淹没服务器
File.Delete(currentSettings.OutputFilePath);
文件.Delete(currentSettings.SvgFilePath);
svgHolder.Value=“”;
}
}
}
以下是家长的密码:


下面是孩子们: