C# 在Asp.net中使用查询字符串打开Ajax选项卡容器选项卡

C# 在Asp.net中使用查询字符串打开Ajax选项卡容器选项卡,c#,asp.net,asp.net-ajax,C#,Asp.net,Asp.net Ajax,可以使用查询字符串打开Ajax选项卡容器的选项卡吗 类似于当查询字符串 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选项卡容器的选项卡吗

类似于当查询字符串

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>

请帮助

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

通过使用它,您可以在服务器端显示所需的选项卡

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

                tabcantainerID.ActiveTabIndex =1
             }
    .....
                 }
              }
在服务器端

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

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

希望这将帮助您根据查询字符串设置选项卡容器的ActiveTabIndex属性。请检查此处: