嵌套中继器项目订单 [英] Item order in nested Repeaters

查看:106
本文介绍了嵌套中继器项目订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个嵌套的中继器,我的问题是关于显示结果。我希望它显示是这样的:

Caption1

  Images1

caption2的(应该是在新的生产线,但没有)

  Images2

Caption3(应该是在新的生产线,但没有)

  Images3

但结果是这样的:

http://s22.postimg.org/v53xrz40h/Capture.jpg

那么如何才能解决?

感谢。

HTML:

 < ASP:直放站ID =rptReferansBaslik=服务器OnItemDataBound =rptReferansBaslik_ItemDataBound>                        <&ItemTemplate中GT;
                            &所述p为H.;
                                < ASP:标签ID =lblCaption=服务器文本='<%#的eval(Ref_Baslik)%>'>< / ASP:标签>
                            &所述; / P>
                            < ASP:直放站ID =rptCalismalar=服务器>
                                <&ItemTemplate中GT;
                                    < UL ID =mb_imagelist级=mb_imagelist>
                                        <立GT;
                                            < IMG SRC =图像/小/<%#的eval(CI_ThumNailURL)%>' ALT =此搜索数据bgimg ='图像/大/<%#的eval(CI_ImageURL)%>' />< /李>
                                    < / UL>
                                < / ItemTemplate中>
                            < / ASP:直放站>                        < / ItemTemplate中>  < / ASP:直放站>

code

 保护无效的Page_Load(对象发件人,EventArgs的发送)
    {
        //列表< Referanslar>清单= Referanslar.GetReferanslarList();
        rptReferanslar.DataSource = Referanslar.GetReferanslarList();
        rptReferanslar.DataBind();
        rptReferansBaslik.DataSource = Referanslar.GetReferanslarList();
        rptReferansBaslik.DataBind();
    }    保护无效rptReferansBaslik_ItemDataBound(对象发件人,RepeaterItemEventArgs E)
    {
        中继器RP =(中继器)e.Item.FindControl(rptCalismalar);
        INT ID = int.Parse(DataBinder.Eval的(e.Item.DataItemREF_ID)的ToString());
        rp.DataSource = CalismalarImages.GetCalismalarImagesList(SELECT * FROM CalismalarImages WHERE CI_CalismaID =+身份证);
        rp.DataBind();
    }


在这种情况下,解决方案

,我认为你应该使用中继器的ListView。你可以做的是创建一个列表视图parentListview,然后一个ListViewchildRepeater是这样的:

  //链接码的手动OnItemDataBound到ItemBound  - 
< ASP:ListView控件ID =parentListview=服务器OnItemDataBound =ItemBound>
          <&ItemTemplate中GT;
                ...
                < ASP:直放站ID =childRepeater=服务器>
                           <&ItemTemplate中GT;
                                  ...
                           < / ItemTemplate中>
                 < / ASP:直放站>          < / ItemTemplate中>
 < / ASP:的ListView>

在code应该是这样的:

  parentListview.DataSource = Listtournoiterminer;
parentListview.DataBind();

和则:

 保护无效ItemBound(对象发件人,ListViewItemEventArgs参数)
{        直放站childRepeater =(中继器)args.Item.FindControl(childRepeater);        ...        childRepeater.DataSource = Top3的;
        childRepeater.DataBind();}

我希望这有助于你!

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 !

这篇关于嵌套中继器项目订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆