使用TextChanged事件更新进度控件不显示图像

时间:2016-12-21 05:04:29

标签: c# asp.net ajax gridview

我希望在TextChanged事件期间显示正在加载图片,因为我在TextChanged事件更改时填写gridview。我正在尝试,但图像没有显示。

以下是我的设计代码:

<asp:Panel ID="pnl_Candidate" runat="server" Visible="false">
   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
           <asp:TextBox ID="txt_CandidateSource" runat="server" OnTextChanged="txt_CandidateSource_TextChanged" AutoPostBack="True" class="form-control input-sm" placeholder="Candidate Source" Width="30%" />

         <asp:GridView ID="GridView1" runat="server" CssClass="footable" Style="max-width: 500px" AutoGenerateColumns="False" OnPageIndexChanging="GridView1_PageIndexChanging" AllowPaging="true" PageSize="5" DataKeyNames="EMail" >
             <Columns>
               <asp:TemplateField HeaderText="Sno">
                 <ItemTemplate>
                 <%# Container.DataItemIndex + 1 %>
                 </ItemTemplate>

               </asp:TemplateField>
              <asp:BoundField DataField="CandidateSource" HeaderText="CandidateSource"></asp:BoundField>
             <asp:BoundField DataField="Name" HeaderText="Name"></asp:BoundField>
              <asp:BoundField DataField="Gender" HeaderText="Gender"></asp:BoundField>
              <asp:BoundField DataField="DOB" HeaderText="DOB"></asp:BoundField>
              <asp:BoundField DataField="Mobile" HeaderText="Mobile"></asp:BoundField>
             <asp:BoundField DataField="EMail" HeaderText="EMail"></asp:BoundField>
             <asp:BoundField DataField="Qualification" HeaderText="Qualification"></asp:BoundField>
            <asp:BoundField DataField="CurrentLocation" HeaderText="CurrentLocation"></asp:BoundField>
            <asp:BoundField DataField="TotalExperience" HeaderText="TotalExperience"></asp:BoundField>
           <asp:BoundField DataField="CurrentCompany" HeaderText="CurrentCompany"></asp:BoundField>
           <asp:BoundField DataField="Designation" HeaderText="Designation"></asp:BoundField>
           <asp:BoundField DataField="WorkLocation" HeaderText="WorkLocation"></asp:BoundField>

           <asp:TemplateField HeaderText="add Comment Status">
           <ItemTemplate>
          <asp:LinkButton ID="lnkbtn_Comment_Status" runat="server"
                                    Text="Comment" OnClick="lnkbtn_Comment_Status_Click"></asp:LinkButton>
         </ItemTemplate>
          </asp:TemplateField>
         </Columns>
          <PagerStyle CssClass="pgr" />
          <EmptyDataTemplate>
          <center>
            <asp:Label ID="Label2" CssClass="Helptext_red" runat="server" Text="No Candidate Available"></asp:Label>
          </center>
          </EmptyDataTemplate>
          <HeaderStyle CssClass="header" />
           <AlternatingRowStyle CssClass="alt" />
           </asp:GridView>

          </ContentTemplate>
        </asp:UpdatePanel>
      <asp:UpdateProgress ID="UpdateProgress2" DisplayAfter="0" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
                <div class="modal">
                    <div class="center">
                        <img alt="" src="loading_bar_animated.gif" />
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>

我的TextChange事件和每个文字更改事件中的Filling网格视图:

protected void txt_CandidateSource_TextChanged(object sender, EventArgs e)
{
    if (txt_CandidateSource.Text != "")
    {
        System.Threading.Thread.Sleep(2000);
        DataTable dt = new DataTable();
        bo.Para1 = txt_CandidateSource.Text;
        bo.Para2 = txt_Qualification.Text;
        bo.Para3 = txt_CurrentLocation.Text;
        bo.Para4 = txt_TotalExperience.Text;
        bo.Para5 = txt_Designation.Text;
        dt = bl.Search_CandidateMaster(bo);
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
}

1 个答案:

答案 0 :(得分:0)

使用此mysqli_*精细作品

<强> CSS:

UpdateProgress

<强> ASPX:

<style type="text/css">
        .rcs {
            display: block;
            position: absolute;
            top: 40%;
            left: 45%;
        }
</style>