I have 2 nested Repeaters, my problem is about the displaying the result. I want it to be displayed like this:
Caption1
Images1
Caption2 (should be at new line but not)
Images2
Caption3 (should be at new line but not)
Images3
But the result is this:
http://s22.postimg.org/v53xrz40h/Capture.jpg
So how can i solve this?
Thanks.
HTML:
<asp:Repeater ID="rptReferansBaslik" runat="server" OnItemDataBound="rptReferansBaslik_ItemDataBound">
<ItemTemplate>
<p>
<asp:Label ID="lblCaption" runat="server" Text='<%#Eval("Ref_Baslik") %>'></asp:Label>
</p>
<asp:Repeater ID="rptCalismalar" runat="server">
<ItemTemplate>
<ul id="mb_imagelist" class="mb_imagelist">
<li>
<img src='images/small/<%#Eval("CI_ThumNailURL") %>' alt="image1" data-bgimg='images/big/<%#Eval("CI_ImageURL") %>' /></li>
</ul>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
Code
protected void Page_Load(object sender, EventArgs e)
{
//List<Referanslar> list = Referanslar.GetReferanslarList("");
rptReferanslar.DataSource = Referanslar.GetReferanslarList("");
rptReferanslar.DataBind();
rptReferansBaslik.DataSource = Referanslar.GetReferanslarList("");
rptReferansBaslik.DataBind();
}
protected void rptReferansBaslik_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Repeater rp = (Repeater)e.Item.FindControl("rptCalismalar");
int id = int.Parse(DataBinder.Eval(e.Item.DataItem, "Ref_ID").ToString());
rp.DataSource = CalismalarImages.GetCalismalarImagesList("SELECT * FROM CalismalarImages WHERE CI_CalismaID=" + id);
rp.DataBind();
}
in this case, I think you should use ListView instead of repeater. What you can do is to create a listview "parentListview" and then a listview "childRepeater" like this :
//Link mannually OnItemDataBound to ItemBound --
<asp:ListView ID="parentListview" runat="server" OnItemDataBound="ItemBound">
<ItemTemplate>
...
<asp:Repeater ID="childRepeater" runat="server">
<ItemTemplate>
...
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:ListView>
The code should look like this :
parentListview.DataSource = Listtournoiterminer;
parentListview.DataBind();
And then :
protected void ItemBound(object sender, ListViewItemEventArgs args)
{
Repeater childRepeater = (Repeater)args.Item.FindControl("childRepeater");
...
childRepeater.DataSource = Top3;
childRepeater.DataBind();
}
I hope this helped you !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.