写了个简单的IFrame Web Part

    1、主要代码:
    
protected   override   void  RenderWebPart(HtmlTextWriter output)
        
{
            
//output.Write(SPEncode.HtmlEncode(Text));
            output.AddAttribute(HtmlTextWriterAttribute.Width,IFrameWidth);
            output.AddAttribute(HtmlTextWriterAttribute.Height,IFrameHeight);
            output.AddAttribute(HtmlTextWriterAttribute.Src,url);
            output.AddAttribute(
"marginwidth","0");
            output.AddAttribute(
"marginheight",marginheight);
            output.AddAttribute(
"frameborder",frameborder);
            output.AddAttribute(
"scrollingr",scrolling);
            output.RenderBeginTag(HtmlTextWriterTag.Iframe);
            output.RenderEndTag();
        }
   
    2、安装包及源代码下载:  http://files.cnblogs.com/dudu/IFrame.rar 
    3、WebPart安装方法:在SharePoint服务器上运行Setup目录中的Install.bat
    4、开发中遇到的问题:
        开始,我给IFrameWebPart添加了Width与Height属性,编译正常,可是在SPS页面上添加这个WebPart就出错,后来发现是因为Microsoft.SharePoint.WebPartPages.WebPart中已经定义Width与Height属性,IFrameWebPart添加的Width与Height属性与它产生了冲突。
   

你可能感兴趣的:(iframe)