简体   繁体   English

如何在ASP.NET中单击按钮后激活Bootstrap选项卡

[英]How To Active Bootstrap Tab after Button Click in ASP.NET

I am working in asp.net and i use twitter bootstrap plugins. 我在asp.net中工作,并且使用Twitter Bootstrap插件。 In my form i use a Tab. 在我的表单中,我使用制表符。 There are two option in Tab. 选项卡中有两个选项。 #1 is Map and #2 is Address . #1Map#2Address Basically i submit a form and save the data into database when data is save then i want saved data shown in #2 Tab ( Address Tab ). 基本上,我提交表单并将保存数据时的数据保存到数据库中,然后我希望保存的数据显示在#2选项卡(“ 地址”选项卡 )中。 I found many article in stackoverflow related it, but i not achieve this. 我在stackoverflow中发现了很多与其相关的文章,但我没有实现。

Code:-ASP 代码:-Asp

            <div class="Map-Panel">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#divMap">Map</a></li>
                    <li><a data-toggle="tab" href="#divAddress">Address</a></li>
                </ul>
                <div class="tab-content">
                    <div id="divMap" class="tab-pane fade in active">
                        <div id="geomap" style="width: 100%; height: 450px;">
                            <p>Loading Please Wait...</p>
                        </div>
                    </div>
                    <div id="divAddress" class="tab-pane fade">
                        <asp:DataList ID="dlAddress" runat="server" CellPadding="4" ForeColor="#333333" RepeatColumns="1" Width="100%">
                        </asp:DataList>
                    </div>
                </div>
            </div>

Code:-Javascript 代码:-Javascript

$('#<%= btnSave.ClientID %>').click(function () {
            $('.nav-tabs > .active').next('li').find('a').trigger('click');
});

If i use HTML submit button then i able to active other tab but through this i can't save my data into database. 如果我使用HTML提交按钮,则可以激活其他选项卡,但是通过此操作,我无法将数据保存到数据库中。 So help me. 所以帮帮我

Did yout tried to wrap both tabs inside the same form? 您是否试图将两个选项卡都包装在同一表格中? This way will send all data from both tabs to your server side script. 这种方式会将所有数据从这两个选项卡发送到服务器端脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM