【问题标题】:Setting default active tab for tabcontainer为选项卡容器设置默认活动选项卡
【发布时间】:2013-07-24 20:24:25
【问题描述】:

我在我的项目中使用 tabcontainer,有两个选项卡,分别是英语和西班牙语。

标签如下:

正如我们在图片中看到的,默认的活动标签集是西班牙语。

我希望它是英文的。

为此,我编写了以下代码:

tcQuestion.ActiveTabIndex = "1"这也是我在页面加载时写的,

在 aspx 中:<asp:TabContainer ID="tcQuestion" runat="server" ActiveTabIndex="1" Width="90%"> 我添加了ActiveTabIndex="1"

但是正如我们在图片中看到的那样,这段代码没有区别。默认选择仅西班牙语。

为了更清楚,我想分享标签容器的整个代码:

<asp:TabContainer ID="tcQuestion" runat="server" ActiveTabIndex="1" Width="90%"  >
        <asp:TabPanel runat="server" HeaderText="English" ID="English" >
            <ContentTemplate>
                <table align="center"  width="90%">
                    <tr>
                        <td align="center" class="Heading" colspan="2" valign="top" >
                         <asp:Label ID="lblEnglish"  Text="Add Question" runat="server" ></asp:Label>
                        </td>
                    </tr>
                    <tr>
                      <td align="right" class="NormalText" width="40%" valign="top" >
                             Question :
                         </td>
                        <td align="left">
                            <asp:TextBox ID="txtEnglishQuestion" runat="server" CssClass="ThinTextBox" Rows="7" Columns="35"  
                                TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>

                </table>
            </ContentTemplate>


        </asp:TabPanel>
         <asp:TabPanel ID="TabPanel2" runat="server" HeaderText="Spanish" >
             <ContentTemplate>
                 <table align="center"  width="90%">
                     <tr>
                         <td align="center" class="Heading" colspan="2" valign="top"  >
                             Add Question
                         </td>
                     </tr>
                     <tr>
                         <td align="right" class="NormalText" width="40%" valign="top" >
                             Question :
                         </td>
                         <td align="left">
                             <asp:TextBox ID="txtQuestionSpanish" runat="server" CssClass="ThinTextBox" Rows="7" Columns="35"  
                                 TextMode="MultiLine"></asp:TextBox>
                         </td>
                     </tr>


                 </table>
             </ContentTemplate>
         </asp:TabPanel>

    </asp:TabContainer>

注意:编程语言对我来说并不重要(无论是 c# 还是 vb.net)

请帮帮我。

【问题讨论】:

    标签: c# asp.net .net vb.net visual-studio-2008


    【解决方案1】:

    您需要将标签索引设置为零 (0)。

    tcQuestion.ActiveTabIndex = 0
    

    【讨论】:

      【解决方案2】:
      tcQuestion.ActiveTabIndex = 0
      

      你已经给出了第二个标签的索引。但是第一个标签的索引应该是 0

      【讨论】:

        猜你喜欢
        • 2019-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-07
        相关资源
        最近更新 更多