<script> $(function() {
$( "#tabs" ).tabs(); });
</script>
&#13;
<div id="tabs">
<ul>
<li><a href="#tabs-1">tab1</a></li>
<li><a href="#tabs-2">tab2</a></li>
<li><a href="#tabs-3">tab3</a></li>
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
</div>
</div>
&#13;
<div id="tabs">
<ul>
<li><a href="#tabs-1">Reg</a></li>
<li><a href="#tabs-2">Summery</a></li>
<li><a href="#tabs-3">Advanced Search</a></li>
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
<table style="width: 100%;">
<tr>
<td>
Company:
</td>
<td>
<asp:DropDownList ID="ddlCompanies" runat="server" CssClass="dropdown" Width="250px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnSearchTotal" runat="server" OnClick="btnSearchTotal_Click" Text="Search"
Width="100px" CssClass="greenbutton" />
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="gdvAuthorize" runat="server" AutoGenerateColumns="False" Width="777px"
OnRowCommand="gdvAuthorize_RowCommand" OnRowEditing="gdvAuthorize_RowEditing"
CssClass="mGrid">
<Columns>
<asp:BoundField DataField="SlipYear" HeaderText="Slip Year" />
<asp:BoundField DataField="SlipMonthName" HeaderText="Slip Month" />
<asp:BoundField DataField="SlipCategoryName" HeaderText="Slip Category Name"></asp:BoundField>
<asp:BoundField DataField="TotalCount" HeaderText="Total Count" />
<asp:ButtonField CommandName="SELECT" ImageUrl="~/images/icon_view.gif" ButtonType="Image">
<ItemStyle Width="20px" />
</asp:ButtonField>
<asp:TemplateField HeaderText="SlipMonthID" Visible="False">
<ItemTemplate>
<asp:Label ID="SlipMonth" runat="server" Text='<%# Bind("SlipMonth") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</p>
</div>
<div id="tabs-2">
<p>
<table style="width: 100%;">
<tr>
<td>
Company:
<td>
<asp:DropDownList ID="ddlCompany" runat="server" CssClass="dropdown" Width="250px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Slip Category:
<td>
<asp:DropDownList ID="ddlSlipCategory" runat="server" CssClass="dropdown" Width="125px">
</asp:DropDownList>
<asp:Label ID="lblError1" runat="server" ForeColor="Red" Text="Select Category"></asp:Label>
</td>
</tr>
<tr>
<td>
Slip Year:
</td>
<td>
<asp:DropDownList ID="ddlSlipYear" runat="server" CssClass="dropdown" Width="125px">
</asp:DropDownList>
<asp:Label ID="lblError2" runat="server" ForeColor="Red" Text="Select Year"></asp:Label>
</td>
</tr>
<tr>
<td>
Slip Month:
</td>
<td>
<asp:DropDownList ID="ddlSlipMonth" runat="server" CssClass="dropdown" Width="125px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="Button2" runat="server" CssClass="greenbutton" OnClick="btnSearch_Click"
Text="Search" Width="100px" />
</td>
</tr>
</table>
</p>
</div>
</table>
</div>
</div>
&#13;
以下是我目前用于标签功能的代码。在tab3内容中,我执行搜索功能并将搜索数据加载到数据网格视图。但是当搜索中没有数据时功能选项卡将自动重定向到选项卡1,如何保留在tab3中而不重定向到选项卡1?
答案 0 :(得分:0)
使用click方法。如果选项卡3上未返回任何结果,请尝试:
$('[href="#tabs-3"]').click();
无论结果如何,都会返回两个标签3。