IFrame中的分析器错误在应用程序页面中添加 [英] Parser Error in IFrame When added in Application Page

查看:55
本文介绍了IFrame中的分析器错误在应用程序页面中添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个SharePoint-2013网页部分,因为我创建了应用程序页面。



在该页面中我使用< ; iframe> 元素。但它给我错误如:



I am creating a SharePoint-2013 web-part in that I have created Application Page.

In that page I am using <iframe> element. But it is giving me error like:

Parser Error
-------------------------------------------------------------------------------------
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The base class includes the field 'frame1', but its type (System.Web.UI.HtmlControls.HtmlIframe) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl).

Source Error:


Line 362:                <tr>
Line 363:                    <td>
Line 364:                        <iframe id="frame1" frameborder="0"  runat="server" scrolling="no" width="100%" height="200px" style="margin: 0px; padding: 0px;" visible="false"></iframe>
Line 365:                    </td>
Line 366:                </tr>


Source File: /_layouts/15/OpportunityViewWP/Dashboard.aspx    Line: 364

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929





但是当我在<中添加相同的< iframe> 时b> Visual-Web-Part 它可以正常工作。



代码我使用过的:



But when I am adding the same <iframe> in Visual-Web-Part it works properly.

Code Which I have used:

<tr>
    <td>
        <iframe id="frame1" frameborder="0"  runat="server" scrolling="no"

               width="100%" height="200px" style="margin: 0px; padding: 0px;"

               visible="false"></iframe>
    </td>
</tr>





这背后的原因是什么?任何人都可以帮我解决这个问题。?



提前谢谢。!!



What is the reason behind this? Can anyone help me to solve this problem.?

Thanks in advance.!!

推荐答案

你好,



请访问 https ://connect.microsoft.com/VisualStudio/feedback/details/736011/iframe-parser-error 用于解决方案/解决方案。
Hi,

Please visit https://connect.microsoft.com/VisualStudio/feedback/details/736011/iframe-parser-error for solution/work around.


它使用c#后面的代码解决您的网页部分或您的应用程序页面如下



公共部分类VisualWebPart1UserControl:UserControl

{

protected void Page_Load(object sender,EventArgs e)

{





string url =;



字符串输出;

output =
< iframe style =+宽度:1000px;高度:750px+src =+ url +>< / iframe>
;



this.Controls.Add(new LiteralControl(output));

}
it solved using code behind c# in your web part or your Application page as follow

public partial class VisualWebPart1UserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{


string url = "" ;

string output;
output = "
<iframe style=" + "width:1000px;height:750px" + " src="+ url +" ></iframe>
";

this.Controls.Add(new LiteralControl(output));
}


这篇关于IFrame中的分析器错误在应用程序页面中添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆