【问题标题】:Open Ajax TabContainer tabs using query string in Asp.net在 Asp.net 中使用查询字符串打开 Ajax TabContainer 选项卡
【发布时间】:2014-11-06 10:41:20
【问题描述】:

是否可以使用query string 打开Ajax Tab Container 的标签页。

类似于查询字符串是

localhost:81/dashboard.aspx?tab=0
localhost:81/dashboard.aspx?tab=1
localhost:81/dashboard.aspx?tab=3

我的代码是

<ajax:TabContainer ID="TabContainer2" runat="server" CssClass="MyTabStyle">
                            <ajax:TabPanel ID="TabPanel2" runat="server" TabIndex="0">
                                <headertemplate>
                                   Overview
                                  </headertemplate>
                                <contenttemplate>                         
                             </contenttemplate>
                            </ajax:TabPanel>
                            <ajax:TabPanel ID="tbpnluser1" runat="server" TabIndex="1">
                                <headertemplate>
                                   Overview
                                </headertemplate>
                                <contenttemplate>                        
                           </contenttemplate>
                            </ajax:TabPanel>
                        </ajax:TabContainer>

请帮忙

【问题讨论】:

标签: c# asp.net asp.net-ajax


【解决方案1】:

是的,有一个名为 ActiveTabIndex 的属性

通过使用它,您可以在服务器端显示您想要的标签

在服务器端

 protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
       if(Request.QuerryString["tab"]==1)
              {

                tabcantainerID.ActiveTabIndex =1
             }
    .....
                 }
              }

希望对你有帮助

【讨论】:

    猜你喜欢
    • 2011-06-02
    • 2014-02-16
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    • 2012-10-04
    • 2021-09-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多