如何停止Bootstrap Tab面板更改按钮单击? [英] how to stop Bootstrap Tab panel Change on Button Click?

查看:87
本文介绍了如何停止Bootstrap Tab面板更改按钮单击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我在项目中使用bootstrap。当我在第二个选项卡上放置了asp按钮时,在我的页面中放置了pan选项卡的代码,并且在按钮的click事件中,所选选项卡将被重置为第一个。但我不想这样做。我只想在任何活动的特定标签上。

Hello,
I am using bootstrap in my project. when i placed the code for pan tab in my page with asp button inside on the second tab, and on click event of the button the selected tab will be reset to first. but i don't want to do it. i just want to be on particular tab on any event.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>
<html>
<head>
  <title>Twitter Bootstrap : Enable Tabs using Javascript </title>
<link rel="stylesheet"

      href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<link rel="stylesheet"

     href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
</head>
<body>
    <form id= "role"  runat="server">
<div class="DemoBS3">
 <ul id="myTab" class="nav nav-tabs">
      <li class="active"><a href="#churchill" data-toggle="tab">Winston Churchill</a></li>
      <li><a href="#lincoln" data-toggle="tab">Lincoln</a></li>
   
      <li class="dropdown">
        
        <a href="#" id="myTabDrop1" class="dropdown-toggle" 

        data-toggle="dropdown">Indian</a>
        
        <ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
          <li><a href="#chanakya" tabindex="-1" data-toggle="tab">Chanakya</a></li>
          <li><a href="#swami" tabindex="-1" data-toggle="tab">Vivekananda</a></li>
        </ul>
        
      </li>
    </ul>
    <div id="myTabContent" class="tab-content">
      <div class="tab-pane in active" id="churchill">
      <p>A politician needs the ability to foretell what is going
        to happen tomorrow, next week, next month, and next year. 
        And to have the ability afterwards to explain why it didn't
        happen.</p>
      </div>
      <div class="tab-pane " id="lincoln">
          <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>
          <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </div>
      <div class="tab-pane " id="chanakya">
     <p> Chanakya</p>
     </div>
      <div class="tab-pane " id="swami">
              <p>Swami</p>
    </div>
    </div></div>
        </form>
</body>
</html>







- 单击tab2上的Button,它将从数据库加载数据并显示在文本框中,但将选项卡重置为churchill选项卡(First标签)。但我完全在Tab2(lincoln)上该选项卡的任何事件




-- On click of Button on tab2 it will load data from the database and shows on textbox, but reset the tab to "churchill" tab(First tab). but i exactly be on the Tab2(lincoln) on any event of that tab

推荐答案

您可以借助HiddenField保留活动选项卡的状态。请参阅在回发c#后保留引导选项卡 [ ^ ]。
You can retain the state of active tab with the help of a HiddenField. Refer the solution given at Remain bootstrap tab after postback c#[^].


这篇关于如何停止Bootstrap Tab面板更改按钮单击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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