Reputation: 307
<script> $(function() {
$( "#tabs" ).tabs(); });
</script>
<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>
<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>
Here is the code that I'm currently using for tab function.In tab3 content i'm performing a search function and load search data to a data grid view.But when there is no data from the search function tab will automatically redirect to tab 1,How do I stay remain in tab3 without redirecting to the tab 1?
Upvotes: 0
Views: 3688
Reputation: 8513
Use the click method. If no results are returned on tab 3, try:
$('[href="#tabs-3"]').click();
this will return you two tab 3 regardless of the results.
Upvotes: 1