惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
S
Schneier on Security
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cyberwarzone
Cyberwarzone
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
GbyAI
GbyAI
Security Latest
Security Latest
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
C
Cisco Blogs
博客园 - 【当耐特】
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
B
Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
The Last Watchdog
The Last Watchdog
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Project Zero
Project Zero
WordPress大学
WordPress大学
L
LINUX DO - 最新话题
F
Fortinet All Blogs
L
LINUX DO - 热门话题
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MongoDB | Blog
MongoDB | Blog
Latest news
Latest news
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
爱范儿
爱范儿
O
OpenAI News
J
Java Code Geeks
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - LuckPanda

试图运行项目时出错:无法启动调试 & mdm.exe 伪装 病毒 安装程序检测到另一个程序要求计算机重新启动.必须重新启动计算机后才能安装visualstudio.net系统必备 尝试live writer写csdn/cnblogs日志 修复vs2003调试器 艾宾浩斯记忆曲线 vs2003和vs2005安装程序制作笔记 Using 未声明 使用线程加载控件,通过delegate创建控件,但仍报错“在某个线程上创建的控件不能成为在另一个线程上创建的控件的父级” winform不能用窗体设计器打开,只能用代码编辑器打开 crystal report(水晶报表) 在vista 下无法预览,与UAC(用户帐号控制)有关 给alimama的建议 十大常用杀毒软件试用 云计算最终会将软件变为免费 云计算淹没了虚拟主机业务 最近网站接连被攻击 SQL 注入 常用手法 Qq2007 正式版 登录协议分析之发报程序C#版本 qq 2007 正式版 协议 分析 91 62 ba dd 22 SharePoint 和 Reporting Service 的集成 今早发现 sharepoint 线程被终止 的提示
怎样在Sharepoint webpart中写 Repeat 、datalist 、datagrid ,读懂这段代码应该可以解决这类问题了
LuckPanda · 2006-07-17 · via 博客园 - LuckPanda

using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using System.Data;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;

namespace Sample.NewInfo
{
 /// <summary>
 /// Description for NewInformation.
 /// </summary>
 [DefaultProperty("Text"),
  ToolboxData("<{0}:NewInformation runat=server></{0}:NewInformation>"),
  XmlRoot(Namespace="NewInfo")]
 public class NewInformation : Microsoft.SharePoint.WebPartPages.WebPart
 {
  private const string defaultText = "";

  private string text = defaultText;
  protected System.Web.UI.WebControls.Repeater Repeater1;

  [Browsable(true),
   Category("Miscellaneous"),
   DefaultValue(defaultText),
   WebPartStorage(Storage.Personal),
   FriendlyName("Text"),
   Description("Text Property")]
  public string Text
  {
   get
   {
    return text;
   }

   set
   {
    text = value;
   }
  }
 


  protected override void CreateChildControls()
  {
   Repeater1=new Repeater();
   Repeater1.ItemTemplate=new RepiTemplate();
   try
   {
    string strConn = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
    DataSet dsInfo = SqlHelper.ExecuteDataset(strConn,CommandType.Text,"SELECT TOP 10 * FROM NewInfo ORDER BY PublishDate DESC");
     
    Repeater1.DataSource=dsInfo;
    Repeater1.DataBind();
   }
   catch (Exception ex)
   {
    throw ex;
   }
   this.Controls.Add(Repeater1);
   base.CreateChildControls ();
  }

  /// <summary>
  /// Render this Web Part to the output parameter specified.
  /// </summary>
  /// <param name="output"> The HTML writer to write out to </param>
  protected override void RenderWebPart(HtmlTextWriter output)
  {

   output.Write("<div id='demo'  style='overflow:hidden;height:200;width:150;vertical-align:middle'><div id='demo1' style='vertical-align:middle'>");
   Repeater1.RenderControl(output);
   output.Write("</div><div id='demo2'  style='vertical-align:middle'></div></div>"); 
   output.Write(@"<script Language=Javascript>
      var speed=200;
      demo2.innerHTML=demo1.innerHTML
      function Marquee()
      {
      if(demo2.offsetTop-demo.scrollTop<=0)
      demo.scrollTop-=demo1.offsetHeight;
      else
      demo.scrollTop+=2;
      }
      var MyMar=setInterval(Marquee,speed)
      demo.onmouseover=function() {clearInterval(MyMar)}
      demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
      </script>");

  }
 }

 class RepiTemplate:ITemplate
 {
  public RepiTemplate(){}

  public void InstantiateIn(Control wc)
  {
   Literal l=new Literal();
   l.DataBinding+=new EventHandler(this.BindData);
   wc.Controls.Add(l);
  }
  public void BindData(object Sender,EventArgs e)
  {
   Literal l=(Literal)Sender;
   System.Web.UI.WebControls.RepeaterItem Con=(System.Web.UI.WebControls.RepeaterItem)l.NamingContainer;
   l.Text ="·<a href='"+((DataRowView)Con.DataItem)["URL"].ToString()+"'>"+((DataRowView)Con.DataItem)["Title"].ToString()+"</a><BR><BR>";
  }
 }

}