我在asp中有以下下拉列表:绑定到SQL数据库以根据查询检索值。
<td>
<asp:DropDownList ID="DropDownList4" runat="server" AppendDataBoundItems="true"
DataSourceID="SqlDataSource1" DataTextField="VALUE" DataValueField="VALUE">
<asp:ListItem Value=" " Selected="true" Text="--Select One--"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT "VALUE" FROM TABLENAME WHERE (column= xx)">
</asp:SqlDataSource>
问题是我想要进行第一个选择-选择一个-现在当我想要重置文本字段时,我想将下拉列表重置为javascript中的值-选择一个-,但我做不到。
我在asp.net中重置了文本文件,如下所示:
document.getElementById('<%= txt_field01.ClientID %>').value = '';
document.getElementById('<%= txt_field01.ClientID %>').value = '';我需要你的支持和想法。
发布于 2017-07-02 23:27:58
var drop = document.getElementById('<%=dropdownID.ClientID%>').querySelectorAll("option:selected");您可以使用以下选项之一
$(drop).empty();或
drop.value = '';或
$('#mydropID').val('');https://stackoverflow.com/questions/44872279
复制相似问题