repeater control

  • Thread starter Thread starter George Ter-Saakov
  • Start date Start date
G

George Ter-Saakov

Depending on some criteria (based on item value) i need to show different
template for item in repeater control?
How do i do that?

Sample:

Repeater1.DataSource = _lstItems;

Repeater1.DataBind();



For regular Items i need to show regular <ItemTemplate> and for items with
Id = -1 i need to show <AlternatingItemTemplate>



How do i do that?



Thanks.

George.
 
Hi George,

ASP.NET Repeater control can only have one Item template. To work arond
this issue, you may add some code in its ItemDataBound event. For example,
you can get current datarow from e.Item.DataItem, and add controls with
e.Item.Controls.add() method.

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top