单击按钮,在VB中切换选项卡

时间:2016-03-25 07:00:03

标签: javascript .net vb.net

我正在用div和javascript创建标签

<div  id="tabs"> 
    <ul class="nav nav-tabs">
        <li><a href="#tabs-1">Issue Part</a></li>
        <li><a href="#tabs-2">Return Part</a></li>

    </ul>
    <div id="tabs-1" > Content </div>
   <div id="tabs-2" > Content </div>

</div>

在tab1和tab2中我有gridview和搜索按钮,当我单击选项卡2上的搜索按钮时,它会在tab2上过滤gridview2的数据但显示tab1如何在按钮单击后显式添加以显示tab2

按钮单击代码

    Protected Sub ImageButton2_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton2.Click
        Dim DataView As New DataView(PopulatePR())
        If (DropDownList2.Text = "OR") Then
            DataView.RowFilter = "Case = '" + Txtcase1.Text + "' OR Name = '" + txtname1.Text + "'"
        Else
            DataView.RowFilter = "Case = '" + Txtcase1.Text + "' AND Name = '" + txtname1.Text + "'"
        End If
        GridView2.DataSource = DataView
        GridView2.DataBind()

End Sub

我试过这个,但它无法正常工作

  MyBase.OnPreRender(e)
        Page.ClientScript.RegisterStartupScript(GetType(Issue_Parts),"TabToSelect", "$('#tabs').tabs({ active:1})", True)

1 个答案:

答案 0 :(得分:0)

我认为正在选择dataGridView选项卡1的控件事件中的某个位置。由于该程序不可能在其上完成它。我强烈建议您找到导致该错误的代码片段。

至于如何明确选择选项卡2.您可以使用添加的行来选择tab Button事件中的tab2。但这只是暂时的问题。再一次强烈建议找到选择tab1的代码片段。

    Protected Sub ImageButton2_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton2.Click
          Dim DataView As New DataView(PopulatePR())
          If (DropDownList2.Text = "OR") Then
              DataView.RowFilter = "Case = '" + Txtcase1.Text + "' OR Name = '" + txtname1.Text + "'"
          Else
              DataView.RowFilter = "Case = '" + Txtcase1.Text + "' AND Name = '" + txtname1.Text + "'"
          End If
          GridView2.DataSource = DataView
          GridView2.DataBind()
          tabControl1.SelectedTab = tabPage2
    End Sub