Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
asp.net中嵌套中继器的编号_Asp.net - Fatal编程技术网

asp.net中嵌套中继器的编号

asp.net中嵌套中继器的编号,asp.net,Asp.net,您好,我正在研究嵌套中继器的概念,但无法获得以下提到的细节的答案 我想在内部中继器上编号,我试过了 但这没有帮助。还提到下面的代码 <div class="tab-pane" id="2"> <br /> <div class="row"> <asp:Repeater ID="rpStateHub" runat="server" OnItemDataBound="rpStateHub_ItemDataBound">

您好,我正在研究嵌套中继器的概念,但无法获得以下提到的细节的答案

我想在内部中继器上编号,我试过了 但这没有帮助。还提到下面的代码

<div class="tab-pane" id="2">
    <br />
    <div class="row">
        <asp:Repeater ID="rpStateHub" runat="server" OnItemDataBound="rpStateHub_ItemDataBound">
            <ItemTemplate>
                <div class="item">
                    <div class="well">
                         <p class="state">
                        <strong>
                            <asp:Label ID="lblStateHub" runat="server" Text='<%#Eval("St_Name")%>'></asp:Label></strong> 
                        </p>                                                       

                        <asp:Repeater ID="rp1Hub" runat="server">
                            <ItemTemplate>
                                <%# Container.ItemIndex + 1 %>                                                           
                             <p class="Hub"><%#Eval("Hub_Name") %></p>
                            </ItemTemplate>
                        </asp:Repeater>


                    </div>
                </div>
            </ItemTemplate>
        </asp:Repeater>
    </div>
</div>


具有所需输出的附加图像。 提前感谢您的帮助


这张图片解释了我的问题

我可以看到几个州的数字,所以它对某些州有效,而对其他州无效,正确吗?您好@Piyush Khatri,它正在工作,但它使用的第一个索引是2,后面是空数字,我映射的图像是我需要的实际输出。您能给我看一下您的代码吗?@Piyush Khatri感谢您的帮助。错误是因为数据库中的空值,现在它工作正常
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Dotcom.BOL;

public partial class scorpion_express_NetworkSe : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindNetworkState();
            BindNetworkHub();
            BindNetworkBranch();
            BindNetworkService();
        }

    }

    public void BindNetworkState()
    {

        DataSet ds = Branch.GetNetworkState();
        if (ds.Tables[0].Rows.Count > 0)
        {
            rpState.DataSource = ds;
            rpState.DataBind();
        }
    }

    public void BindNetworkHub()
    {

        DataSet ds = Branch.GetNetworkHub();
        if (ds.Tables[0].Rows.Count > 0)
        {
            rpStateHub.DataSource = ds;
            rpStateHub.DataBind();
        }
    }

    public void BindNetworkBranch()
    {

        DataSet ds = Branch.GetNetworkBranch();
        if (ds.Tables[0].Rows.Count > 0)
        {
            rpStateBranch.DataSource = ds;
            rpStateBranch.DataBind();
        }
    }


    public void BindNetworkService()
    {

        DataSet ds = Branch.GetNetworkService();
        if (ds.Tables[0].Rows.Count > 0)
        {
            rpStateService.DataSource = ds;
            rpStateService.DataBind();
        }
    }
    //protected void rpState_ItemDataBound(object sender, RepeaterItemEventArgs e)
    //{
    //    Repeater innerRepeater = (Repeater)e.Item.FindControl("rpHub");
    //    Repeater innerRepeater1 = (Repeater)e.Item.FindControl("rpBranch");
    //    Repeater innerRepeater2 = (Repeater)e.Item.FindControl("rpService");
    //    Label item = (Label)e.Item.FindControl("lblState");
    //    string state = item.Text;

    //    DataSet ds = Branch.getHub(state);
    //    DataSet ds1 = Branch.getBranch(state);
    //    DataSet ds2 = Branch.getService(state);

    //    if (ds.Tables[0].Rows.Count > 0)
    //    {
    //        innerRepeater.DataSource = ds;
    //        innerRepeater.DataBind();            
    //    }
    //    if (ds1.Tables[0].Rows.Count > 0)
    //    {
    //        innerRepeater1.DataSource = ds1;
    //        innerRepeater1.DataBind();
    //    }
    //    if (ds2.Tables[0].Rows.Count > 0)
    //    {
    //        innerRepeater2.DataSource = ds2;
    //        innerRepeater2.DataBind();
    //    }

    //}

    protected void rpStateHub_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Repeater innerRepeater4 = (Repeater)e.Item.FindControl("rp1Hub");

        Label item = (Label)e.Item.FindControl("lblStateHub");
        string state = item.Text;

        DataSet ds3 = Branch.getHub(state);

            if (ds3.Tables[0].Rows.Count > 0)
            {
                innerRepeater4.DataSource = ds3;
                innerRepeater4.DataBind();
            }

    }

    protected void rpStateBranch_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Repeater innerRepeater5 = (Repeater)e.Item.FindControl("rp1Branch");

        Label item = (Label)e.Item.FindControl("lblStateBranch");
        string state = item.Text;

        DataSet ds4 = Branch.getBranch(state);

        if (ds4.Tables[0].Rows.Count > 0)
        {
            innerRepeater5.DataSource = ds4;
            innerRepeater5.DataBind();
        }


    }

    protected void rpStateService_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Repeater innerRepeater6 = (Repeater)e.Item.FindControl("rp1Serv");

        Label item = (Label)e.Item.FindControl("lblStateService");
        string state = item.Text;

        DataSet ds5 = Branch.getService(state);

        if (ds5.Tables[0].Rows.Count > 0)
        {
            innerRepeater6.DataSource = ds5;
            innerRepeater6.DataBind();
        }


    }
}

HI @Piyush Khatri here is the code behind file