.net 里多层 repeater 的嵌套使用(c#)

上一篇 / 下一篇  2008-04-22 21:13:08 / 个人分类:技术文章

后台.cs程序:

protected void objectiveCategory2_ItemDataBound

(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)

{ DataView dv = new DataView(this.dtCategory);

dv.RowFilter = "eloc_iparentid=" + this.dtCategory.Rows[e.Item.ItemIndex]["eloc_iparentid"].

ToString();

Repeater tempRepeater = (Repeater)e.Item.FindControl("elo_sdescription");

tempRepeater.DataSource = dv; tempRepeater.DataBind(); }

注意:其中第2层的 nItemDataBound="objectiveCategory2_ItemDataBound 是重要部分,因为里层的repeater web里是认识不到的,只有在这指明了事件处理方法,才能触发后台程序里的方法。类似的也可以用这种方法多层嵌套,并能处理里面的事件。

第二点在 aspx 指明事件的在后台程序,需要protected 来限定访问限制,如用private 就会出现限制访问的错误提示。


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-07-24  
  12345
6789101112
13141516171819
20212223242526
2728293031  

数据统计

  • 访问量: 58546
  • 日志数: 24223
  • 建立时间: 2007-12-06
  • 更新时间: 2008-06-15

RSS订阅

Open Toolbar