using(new SPSite("http://mysite/myweb").OpenWeb())
{

//give relative path of the webpartpage
SPLimitedWebPartManager wm = page.GetLimitedWebPartManager("default.aspx", 
      System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
 
    foreach (System.Web.UI.WebControls.WebParts.WebPart wp in wm.WebParts)
    {
    }
}

if (wp.GetType().ToString() == "Microsoft.SharePoint.WebPartPages.SPUserCodeWebPart")
额,那你属性所有webpart的特点,争取一眼看出来

 
 You can add ?contents=1 to the end of your page's URL to get a nice neat list of all the webparts that are currently opened and closed: http://sharepointsolutions.blogspot.com/2008/04/when-good-web-parts-go-bad.html
 
 

判断webpart类型 How can I tell what type a web part is?的更多相关文章

  1. javascript 判断参数类型大全

    js 判断类型的在开发中是很常用的,因为js 是弱类型的语言,var 可以接受任何形式的类型,但是在真正的开发中,我们需要根据不同类型做不同的处理,所以这个是必须的精通. 首先需要知道 typeof这 ...

  2. js判断undefined类型

    js判断undefined类型 if (reValue== undefined){    alert("undefined");    }  发现判断不出来,最后查了下资料要用ty ...

  3. JavaScript根据文件名判断文件类型

    //JavaScript根据文件名判断文件类型 var imgExt = new Array(".png",".jpg",".jpeg",& ...

  4. js判断浏览器类型以及浏览器版本

    判断浏览器类型:   if navigator.userAgent.indexOf(”MSIE”)>0) {} //判断是否IE浏览器 if(isFirefox=navigator.userAg ...

  5. 判断浏览器类型用 document.documentMode方式,

    if ( document.documentMode && document.documentMode < 9 ){ document.write( '<script sr ...

  6. 利用PHP取二进制文件头判断文件类型

    <?php $files = array('D:\no.jpg', 'D:\no.png','D:\no2.JPEG','D:\no.BMP'); $fileTypes = array( 779 ...

  7. JAVA判断各种类型数据是否为空

    1.判断list是否为空(Map.Set同list) if(list != null && list.size() == 0){ } if(list != null && ...

  8. JavaScript中判断对象类型方法大全2

    在JavaScript中,有5种基本数据类型和1种复杂数据类型,基本数据类型有:Undefined, Null, Boolean, Number和String:复杂数据类型是Object,Object ...

  9. html5 -js判断undefined类型

    js判断undefined类型 今天使用showModalDialog打开页面,返回值时.当打开的页面点击关闭按钮或直接点浏览器上的关闭则返回值是undefined所以自作聪明判断 var reVal ...

随机推荐

  1. Repeater控件中的LinkButton(转)

    LinkButton小用法: 1.在使用时可以通过CommandName和CommandArgument属性联合起来绑定并传值,如:CommandName="record"Comm ...

  2. 关于css制作圆角

    三个阶段: 1.背景图片: 2.css2.0+标签模拟圆角: 3.css3.0圆角属性(border-radius). 1.1.背景图片--宽度固定,高度自适应圆角 为容器设置宽度 在主体的上方加一个 ...

  3. Redis - HyperLogLogs

    A HyperLogLog is a probabilistic data structure used in order to count unique things (technically th ...

  4. MongoDB - Introduction to MongoDB, Documents

    MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...

  5. django 学习-3 模板变量

    1.vim learn/home.html <!DOCTYPE html><html><head>        <title>{{title}}< ...

  6. 改变UITextField placeHolder 字体 颜色

    [_textSearchField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"]; ...

  7. block的动态传值例子

    /*  写一个block传值  ,让两个数进行相除和相乘,在运行时动态决定采用哪种计算方式 */ #import <Foundation/Foundation.h> int main(in ...

  8. OC2_引用计数

    // // Dog.h // OC2_引用计数 // // Created by zhangxueming on 15/6/18. // Copyright (c) 2015年 zhangxuemin ...

  9. 免费的HTML5连载来了《HTML5网页开发实例详解》连载(五)图解通过Fiddler加速开发

    Fiddler是Windows底下最强大的请求代理调试工具,监控任何浏览器的HTTP/HTTPS流量,窜改客户端请求和服务器响应,解密HTTPS Web会话,图4.44为Fiddler原理示意图. 图 ...

  10. MyEclipse导入ant项目——Java编程思想

    北门煎饼东门串儿: <JAVA编程思想(Think in Java)>一书中提供了大量源代码,可是项目是用ant构建的.对于用惯了eclipse,netbeans等IDE的同学们可能有些手 ...