我在一个页面中有几个选项卡,因此在第二个最后一个选项卡中,我为用户提供了过滤选项。在我单击搜索按钮时选择了适当的过滤器后,它正在进行过滤但是加载了页面第一个标签。就像第一次加载页面一样。所以我的问题是,如何在点击搜索按钮后保持在同一个选项卡中。请举个例子来建议我。这是我特定标签的代码 -
<div id="requestHistory" class="tab-pane">
<br/>
<asp:UpdatePanel ID="UpdatePanelCRHistory" runat="server" CssClass="row" DefaultButton="btnSearch" UpdateMode="Conditional">
<ContentTemplate>
<div class="colmd-3 col-sm-3 col-xs-3 responsive-filterbar">
<asp:DropDownList runat="server" ID="drpCRHistoryFramework" ClientIDMode="AutoID" DataTextField="title" DataValueField="frameworkID" CssClass="form-control" AutoPostBack="true" OnSelectedIndexChanged="drpCRHistoryFramework_SelectedIndexChanged">
<asp:ListItem Selected="true" Text ="--Framework--" value="0" ></asp:ListItem>
</asp:DropDownList>
</div>
<div class="colmd-3 col-sm-3 col-xs-3 responsive-filterbar">
<asp:DropDownList runat="server" ID="drpCRHSkillName" ClientIDMode="AutoID" DataTextField="skillName" DataValueField="skillID" CssClass="form-control" AutoPostBack="true" OnSelectedIndexChanged="drpCRHSkillName_SelectedIndexChanged">
<asp:ListItem Selected ="true" Text ="--Competency Name--" Value ="0"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="colmd-3 col-sm-3 col-xs-3 responsive-filterbar">
<asp:DropDownList runat="server" ID="drpCRHLevel" ClientIDMode="AutoID" CssClass="form-control" AutoPostBack="true" >
<asp:ListItem Selected ="true" Text ="--Competency Level--" Value ="0"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-3 col-sm-12 col-xs-12 responsive-filterbar">
<div class="input-group">
<asp:TextBox runat="server" ID="canidateRequestHistorySearchTextBox" ClientIDMode="Static" CssClass="form-control"></asp:TextBox>
<span class="input-group-btn">
<asp:LinkButton runat="server" ID="canidateRequestHistorySearchLinkButton" ClientIDMode="Static" OnClick="btncandidateRequestHistorySearch" CssClass="btn btn-primary" CausesValidation="false" ><span class="glyphicon glyphicon-search"></span></asp:LinkButton>
</span>
</div>
</div><br /><br />
<div class="colmd-3 col-sm-3 col-xs-3 responsive-filterbar input-group date" style="padding-left: 15px;" id="dpDate">
<asp:TextBox runat="server" ID="txtFormDate" ClientIDMode="Static" TextMode="SingleLine" CssClass="form-control datepicker" placeholder="From Date"></asp:TextBox>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
<asp:TextBox runat="server" ID="txtToDate" ClientIDMode="Static" TextMode="SingleLine" CssClass="form-control datepicker" placeholder="To Date"></asp:TextBox>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<br/><br/>
</ContentTemplate>
</asp:UpdatePanel>
<asp:GridView runat="server" ID="grdCandidateRequestHistory" ClientIDMode="Static" AutoGenerateColumns="false"
CssClass="table" BorderWidth="0px" HeaderStyle-CssClass="gridview-header" AlternatingRowStyle-CssClass="gridview-alternative"
GridLines="Horizontal">
<AlternatingRowStyle BackColor="White" CssClass="gridview-alternative" ForeColor="#284775" />
<EmptyDataTemplate>
<h3 style="float: left;" class="text-warning">There are currently no request history</h3>
</EmptyDataTemplate>
<Columns>
<asp:TemplateField HeaderText="Mentor Name">
<ItemTemplate>
<asp:Label runat="server" ID ="lblMentorName" ClientIDMode="Static" Text='<%# Eval("MentorName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Requested Competency">
<ItemTemplate>
<asp:Label runat="server" ID ="lblSkillName" ClientIDMode="Static" Text='<%# Eval("skillName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Requested Competency Level">
<ItemTemplate>
<asp:Label runat="server" ID="lblSkillLevel" ClientIDMode="Static" Text='<%# Eval("levelValue") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sent Date">
<ItemTemplate>
<asp:Label runat="server" ID="lblSentDate" ClientIDMode="Static" Text='<%# Eval("requestDate") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label runat="server" ID="lblStatus" ClientIDMode="Static" Text='<%# Eval("status") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Center" CssClass="cssPager" />
<HeaderStyle BackColor="#5D7B9D" CssClass="gridview-header" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
</div>
以下是按钮背后的代码 -
protected void btncandidateRequestHistorySearch(object sender, EventArgs e)
{
searchQuery = canidateRequestHistorySearchTextBox.Text;
skillLevel= drpCRHLevel.SelectedValue;
var candidateRequestHistoryByFiltering = CandidateRequestManager.GetCandidateRequestHistory(((int)Session[CommonHelper.Constants.CURRENT_CANDIDATE]), frameworkID, skillID, null, null, null);
grdCandidateRequestHistory.DataSource = candidateRequestHistoryByFiltering;
grdCandidateRequestHistory.DataBind();
}
答案 0 :(得分:0)
您可以使用JavaScript或jQuery为您执行此操作,并从后面的代码中调用JavaScript 这样的事情 JavaScript:
function closeWin() {
document.getElementById("Div").style.display = "block";
}
背后的代码
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "closeWin()", true);