【发布时间】:2025-12-05 17:25:01
【问题描述】:
当用户从 Dropbox 中选择 Sample Id 时,我需要停止页面刷新。因为我使用的是折叠 Bootstrap 功能,所以我不希望用户每次选择新的样本 ID 来查看查询结果时都单击链接(单击此处更新样本)。请看下图 PS:SQL代码有效。谢谢
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 </span></strong></span>
<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>
【问题讨论】: