不止一个asp:使用相同数据源的Repeater Control

时间:2013-06-05 05:40:10

标签: asp.net

在我的项目中我有我的个人资料表格。表格有个人资料,物理,其他和用户信息。我已经创建了所有这些的标签,即个人资料,物理,其他,关于用户信息。我有不同的div具有转发器控件的标签,其中包含有关相关选项卡的信息。我在数据库中有成员配置文件表,其中包含所有这些信息。所以我创建了数据集,其中包含表中的所有这些信息,我正在使用该单个数据集将数据绑定到转发器控件。问题是,当我单击选项卡时,只有第一个选项卡显示信息,但当我点击另一个选项卡时,他们打开div但不显示信息。我给我的代码请检查出来,并提供任何解决方案如何在单个表单上使用多个转发器控件,并且可以使用相同的数据集来绑定数据。我还想要求使用表单视图控件来实现此目的。enter code here                                                                                                                                                                                                                                      高度:                                                                                                       <%#的eval( “高度”)%>                                                                                                                                                                 重量”                                                                                                       <%#Eval(“wt”)%>                                                                                                                                                                 肤色:                                                                                                       <%#的eval( “skincolor”)%>                                                                                                                                                                 眼力:                                                                                                       <%#的eval( “视力”)%>                                                                                                                                                                  

            </div>
            <div id="aboutMe" runat="server" visible="false" style="margin-left: 50px;     display: none">
                <asp:Repeater ID="repAbootMe" runat="server">
                    <HeaderTemplate>
                        <table>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td class="directorytdWidth">
                                About Me:
                            </td>
                            <td class="directoryTdPadding">
                                <%#Eval("aboutMe")%>
                            </td>
                        </tr>
                        <tr>
                                <td class="directorytdWidth">
                                Active Friendship Zone:
                                </td>
                                <td class="directoryTdPadding">
                                <%#Eval("friendship")%>
                                </td>
                        </tr>

                </ItemTemplate>
                <FooterTemplate>
                    </table></FooterTemplate>

我已将代码中的数据绑定在后面,因为我已经为此创建了存储过程。 请建议我任何解决方案。谢谢提前

代码背后:enter code here      protected void Page_Load(object sender,EventArgs e)         {             Int32 candiid =(Int32)(Session [“candiID”]);             InsertRegistation viewProfile = new InsertRegistation();             DataSet ds = viewProfile.ViewProfile(candiid);             repProfileInfo.DataSource = ds;            repProfileInfo.DataBind();            repPhysicalInfo.DataSource = ds;            repPhysicalInfo.DataBind();            repAbootMe.DataSource = ds;            repAbootMe.DataBind();            repOtherInfo.DataSource = ds;            repOtherInfo.DataBind();

        string id = Request.QueryString["id"];
        if (!IsPostBack)
        {
            if (id == null)
             {
                if (profileInfo.Visible == false)
                {
                    repProfileInfo.DataSource = ds;
                    repProfileInfo.DataBind();
                    profileInfo.Visible = true;
                }
            }
            switch (id)
            {
                 case "profileInfo": if (profileInfo.Visible == false)
                    {
                        repProfileInfo.DataSource = ds;
                        repProfileInfo.DataBind();
                        profileInfo.Visible = true;
                    }
                    else
                    {
                        profileInfo.Visible = false;
                    }
                    break;
                case "physicalInfo": if (physicalInfo.Visible == false)
                    {
                        repPhysicalInfo.DataSource = ds;
                        repPhysicalInfo.DataBind();
                        physicalInfo.Visible = true;
                    }
                    else
                    {
                        physicalInfo.Visible = false;
                    }
                    break;
                case "aboutMe": if (aboutMe.Visible == false)
                    {
                        repAbootMe.DataSource = ds;
                        repAbootMe.DataBind();
                        aboutMe.Visible = true;
                    }  
                    else
                    {
                        aboutMe.Visible = false;
                    }
                    break;
                case "otherInfo": if (otherInfo.Visible == false)
                    {
                        repOtherInfo.DataSource = ds;
                        repOtherInfo.DataBind();
                        otherInfo.Visible = true;
                    }
                    else
                    {
                        otherInfo.Visible = false;
                     }
                     break;

            }

         }

     }

0 个答案:

没有答案