使用Bootstrap和C#停止页面刷新

时间:2017-04-24 14:16:34

标签: css postback

当用户从Dropbox中选择Sample Id时,我需要停止页面刷新。因为我正在使用折叠Bootstrap功能,所以每次选择新的样本ID以查看查询结果时,我都不希望用户单击链接(单击此处更新样本)。请看下面的图片 PS:SQL代码有效。感谢

enter image description here

HTML代码

<div class ="container">
 <asp:HyperLink ID="UpdateSample" runat="server" Enabled="False" Visible="False" href="#UpdateSampleForm" data-toggle="collapse" CssClass="auto-style47">Click Here to Update Sample</asp:HyperLink>

  <div id="UpdateSampleForm" class="collapse">
      <div class="auto-style110">
      <div>
       <span class="auto-style98"><strong><span class="auto-style114">Select Sample ID&nbsp;&nbsp; </span></strong></span>&nbsp;&nbsp;&nbsp;

   <asp:DropDownList ID="DropDownListUpdateSample" runat="server" Height="37px" Width="132px" CssClass="auto-style111" AutoPostBack = "true" OnSelectedIndexChanged="DropDownListUpdateSample_SelectedIndexChanged" AppendDataBoundItems="False" OnClientClick="return false;" >
             </asp:DropDownList>                        

  </div>
  <table class="table table-condensed" style="width: 89%; font-size: smaller; height: 404px;">
     <thead>
        <tr class="auto-style54">
           <th class="auto-style12">MBID *</th>
           <th class="auto-style10">Sample ID*</th>
            <th class="auto-style11">Sample Type * </th>
             <th class="auto-style70">Sample Date</th>
             <th class="auto-style75">Sample Trial</th>
              <th class="auto-style12">First Sample Select</th>
               <th class="auto-style12">Comments</th>
             </tr>
           </thead>
        <tbody>
           <tr>
             <td class="auto-style48">
              <asp:TextBox class="form-control text-uppercase" ID="txtUpdateSample" runat="server" Height="29px" Width="145px" placeholde= "MBID" required="required" autofocus="autofocus" ReadOnly="True"></asp:TextBox>
              </td>
             <td class="auto-style49">
               <asp:TextBox  class="form-control text-uppercase" ID="txtUpdateSampleID" runat="server" Height="29px" Width="119px"  placeholde= "Sample Type" required="required" autofocus="autofocus" ReadOnly="True"></asp:TextBox>
            </td>
             <td class="auto-style73">
               <asp:TextBox  class="form-control text-uppercase" ID="txtUpdateSampleType" runat="server" Height="29px" Width="119px"  placeholde= "Sample Type" required="required" autofocus="autofocus"></asp:TextBox>
             </td>
             <td class="auto-style71">
             <asp:TextBox class="form-control text-uppercase" ID="txtUpdateSampleDate" runat="server" Height="32px" Width="104px" placeholde= "dd/mm/yyyy" required="required" autofocus="autofocus"></asp:TextBox>
          <asp:CompareValidator ID="CompareValidator9" runat="server" ControlToValidate="txtSampleDate" ErrorMessage="Invalid Date Format" 
          Type="Date" Operator="DataTypeCheck" Display="Dynamic" 
        Text="Invalid Date Format dd/MM/yyyy" ForeColor="Red" ValidationGroup="valGroup1">
        </asp:CompareValidator>
        </td>
         <td class="auto-style76">
          <asp:TextBox class="form-control text-uppercase" ID="txtUpdateSampleTrial" runat="server" Height="30px" Width="136px" placeholde= "Sample Trial Number" ></asp:TextBox>
          </td>
           <td class="auto-style49">
            <asp:DropDownList ID="DropDownListUpdateFirstSample" runat="server" Height="34px" Width="146px" class="text-uppercase" CssClass="auto-style29">
        <asp:ListItem></asp:ListItem>
        <asp:ListItem Value="Yes" Text="Yes"></asp:ListItem>
          <asp:ListItem Value="No" Text="No"></asp:ListItem>
          </asp:DropDownList>
          </td>

          <tr>
           <td class="auto-style5">
            <asp:Button class="btn btn-lg btn-info btn-block" ID="btnUpdateSample" runat="server" Text="Update Sample" Height="41px" Width="161px"  OnClick="btnAddSample_Click" UseSubmitBehavior="false" data-dismiss="modal" />
            </td>
              </tr>
       </tbody>
      </table>
     </div>                     
        </div>   

1 个答案:

答案 0 :(得分:0)

你可以使用Javascript进行暂停:

function pause() {
    setTimeout(function () {
        location.pause();
    }, (60 * 1000));
}

六十秒后它再次重新加载。您可以增加此数字,以便在重新加载时等待更长时间。