Last post Nov 11, 2010 11:46 AM by hsobhy
Aug 26, 2010 12:33 PM|hsobhy|LINK
I'm working on an VB.Net application which have 2 nasted repeaters using xml as data source. I need to add a conditional statement withen the first repeater ItemTemplate as follows:
<%# IIf(XPath("@type")= 3 , "<html>", "<div id=""tblPages"" runat=""server""><divsub""><h2>" & XPath("@title") & "</h2><ul class="sublinks"><asp:repeater id=""rpPages"" DataSource=""XPathSelect("@page")"" runat=""server""><ItemTemplate><li></li></ItemTemplate></asp:Repeater></ul></div></div>" ) %>
The problem come when I try to add the
DataSource='<%# XPathSelect("page") %>'
so I get an error.
Does anyone have idea if the above code may work?
Aug 29, 2010 10:17 PM|Decker Dong - MSFT|LINK
private void Page_Load(object sender, System.EventArgs e)
DataSet ds = new DataSet();
CategoryRepeater.DataSource = ds;
For setting up the outter
repeater, we handle the ItemDataBound event of the Repeater class which is raised when an item is data-bound but before it is rendered on the page. We now get
a reference to the PlayerRepeater control using RepeaterItem.FindControl and set its data source using
CreateChildView and the automatic relation that's made for us -
category_cricketer. By the way I was quite impressed by that, I never expected automatic relations to be created based on the
XML. Pretty cool I think!
private void CategoryRepeater_ItemDataBound(object sender,
RepeaterItem item = e.Item;
if( (item.ItemType == ListItemType.Item) ||
(item.ItemType == ListItemType.AlternatingItem) )
PlayerRepeater = (Repeater) item.FindControl("PlayerRepeater");
DataRowView drv = (DataRowView)item.DataItem;
PlayerRepeater.DataSource = drv.CreateChildView("category_cricketer");
For more please see this article: http://www.codeproject.com/KB/aspnet/AspNetNestedRepeaters.aspx
Sep 01, 2010 11:43 AM|hsobhy|LINK
thank you for your reply but this is not the way I want things go. I allready had a way to fix through the code behinde. In my case, I just need a fix for the douple quotes issues inside my if condition code of the first repeater and want all that happen
out of the dll.
Actually I need to to make the code go like:
<repeater DataSource=""XPathSelect("@item")"" runat=""server""><ItemTemplate></ItemTemplate></repeater>
<repeater DataSource=""XPathSelect("@page")"" runat=""server""><ItemTemplate></ItemTemplate></repeater>
Nov 11, 2010 11:46 AM|hsobhy|LINK
I know It's an old topic, but I need a solution for it again. Is it that hard or it's wrong to ask. please help
Thanks in advance