一切福田,不離方寸,從心而覓,感無不通。

repeater控件的ItemCreated事件的代码示例

public   void   repeater1_ItemCreated(object   sender,   RepeaterItemEventArgs   e)  
  {  
  DataRowView   row   =   (DataRowView)e.Item.DataItem;  
  string   url   =   "id="+row["zyid"].ToString();  
  string   text   =   row["职业名称"].ToString();  
  string   cat_num   =   row["数量"].ToString();  
   
  HyperLink   link   =   new   HyperLink();  
  link.NavigateUrl   =   "upPage.aspx?"   +   url;  
  link.Text   =   text;  
   
  e.Item.Controls.Add(link);  
  e.Item.Controls.Add(new   LiteralControl("&nbsp&nbsp&nbsp"));//项之间加空格  
  }

from:http://czhjq.blog.163.com/blog/static/850149620082434354628/