2015-06-02 58 views
0

我在一個頁面中有幾個標籤,因此在第二個標籤中,我給用戶提供了用於過濾的選項。當我單擊搜索時選擇適當的過濾器按鈕,它正在進行過濾,但加載第一個標籤的頁面。像第一次加載頁面。所以我的問題是,如何在點擊搜索按鈕後留在同一個標​​籤中。請給我一些例子。這裏是我的那個特定的製表如何在顯示搜索結果後保留在同一個標​​籤中

<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

您可以使用JavaScript或者jQuery來爲你做這一點,從調用JavaScript

function closeWin() { 
    document.getElementById("Div").style.display = "block"; 
} 

代碼背後

0:後面 像這樣 JavaScript代碼
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "closeWin()", true); 
相關問題