tabpanel动态内容未显示

时间:2017-07-27 10:06:22

标签: html asp.net-mvc

我面临的问题是:当两者具有相同的代码时,为什么动态数据保留在TAB1中而不保留在TAB2中?

我怀疑它与面板有关,但我不确定。 谢谢你的帮助。



<div class="modal fade in" id="modalReimburseInfo" data-backdrop="static" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
                        <div class="modal-dialog modal-lg modal-mid">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                                    <h3 id="H8" runat="server" style="padding-left: 2%" class="modal-title">Reimbursement Details</h3>
                                </div>
                                  <ul class="nav nav-tabs" role="tablist">
                                <li><a href="#tab1" aria-controls="tab1" role="tab" data-toggle="tab">Daily</a></li>
                                <li><a href="#tab2" aria-controls="tab2" role="tab" data-toggle="tab">Monthly</a></li>
                            </ul>
                                  <asp:UpdatePanel runat="server" ID="upEmpReimburse">
                                    <ContentTemplate>
                                        <!-- Navigation Tabs starts -->
                          
                            <!-- Navigation Tabs ends -->
  
                                         <!-- Tab Panes starts -->
                            <div class="tab-content" style="padding-top: 10px">
                                <div role="tabpanel" class="tab-pane active" id="tab1">
                                        <div class="modal-body">
                                            <div class="form-horizontal" role="form">
                                                <div class="form-group">
                                                    <div class="col-lg-12">

                                                        <div class="form-horizontal" role="form">
                                                            <div class="col-lg-6">
                                                                <div class="form-horizontal" role="form">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-5 control-label">Name :</label>
                                                                        <div class="col-lg-7">
                                                                            <label runat="server" id="lblrdName" class="control-label"></label>
                                                                        </div>
                                                                    </div>
                                                                    <div class="form-group">
                                                                        <label class="col-lg-5 control-label">Department :</label>
                                                                        <div class="col-lg-7">
                                                                            <label runat="server" id="lblrdDept" class="control-label"></label>
                                                                        </div>
                                                                    </div>
                                                                      
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-12">

                                                        <div class="form-horizontal" role="form">
                                                            <asp:GridView ID="grdRbInfo" runat="server" AutoGenerateColumns="False" CssClass="tablesorter table table-bordered table-hover table-striped smallTable tblCtr"
                                                                OnRowCreated="grdRbInfo_RowCreated" >
                                                                <Columns>
                                                                    <asp:TemplateField HeaderText="Date Range">
                                                                        <ItemTemplate>
                                                                            <%#Eval( "DateRange")%>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Amount ($)">
                                                                        <ItemTemplate>
                                                                            <%#Eval( "Amt")%>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                            </asp:GridView>
                                                           <a onclick="PrintReimburseTab1();" class="btn btn-primary nextBtn pull-left btnCtrs lnkbtn" style="padding: 6px 20px 6px 20px;" ><i class="fa fa-print"></i></a>
                                                        </div>
                                                    </div>
                                                 </div>
                            
                                                </div>
                                              </div> 

                                            </div>
    
                                                     
                                <div role="tabpanel" class="tab-pane" id="tab2">
                                     <div class="modal-body">
                                            <div class="form-horizontal" role="form">
                                                <div class="form-group">
                                                    <div class="col-lg-12">

                                                        <div class="form-horizontal" role="form">
                                                            <div class="col-lg-6">
                                                                <div class="form-horizontal" role="form">
                                                                    <div class="form-group">
                                                                        <label class="col-lg-5 control-label">Name :</label>
                                                                        <div class="col-lg-7">
                                                                            <label runat="server" id="Label1" class="control-label"></label>
                                                                        </div>
                                                                    </div>
                                                                    <div class="form-group">
                                                                        <label class="col-lg-5 control-label">Department :</label>
                                                                        <div class="col-lg-7">
                                                                            <label runat="server" id="Label2" class="control-label"></label>
                                                                        </div>
                                                                    </div>
                                                                    
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-12">

                                                        <div class="form-horizontal" role="form">
                                                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="tablesorter table table-bordered table-hover table-striped smallTable tblCtr"
                                                                OnRowCreated="grdRbInfo_RowCreated" >
                                                                <Columns>
                                                                    <asp:TemplateField HeaderText="Date Range">
                                                                        <ItemTemplate>
                                                                            <%#Eval( "DateRange")%>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Amount ($)">
                                                                        <ItemTemplate>
                                                                            <%#Eval( "Amt")%>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                            </asp:GridView>
                                                           <a onclick="PrintReimburseTab1();" class="btn btn-primary nextBtn pull-left btnCtrs lnkbtn" style="padding: 6px 20px 6px 20px;" ><i class="fa fa-print"></i></a>
                                                        </div>
                                                    </div>
                                                 </div>
                            
                                                </div>
                    
                                            </div>

                                    </div>
                                </div>

                            <!-- Tab Panes ends -->
                                
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                        </div>
                    </div>
&#13;
&#13;
&#13;

不确定影响此结果的可能因素是什么。 我添加了标签插件基础和我在网上看到的示例。 选项卡中的内容切换是正确的,但数据在第二个选项卡中不显示。一切都在tab1中运行良好,但在tab2

中没有

1 个答案:

答案 0 :(得分:0)

好的家伙我发现它导致错误的ID。所有label1,label2我都重新创建并替换为正确的ID。感谢