【问题标题】:html5 validation on asp:dropdownlistasp:dropdownlist 上的 html5 验证
【发布时间】:2015-07-08 14:47:50
【问题描述】:

有没有办法在 asp:dropdownlist 上使用 html5 验证(不是 asp:RequiredFieldValidator)。我已经试过了:

<asp:DropDownList ID="ExpenseLineTypeDdl" required="required" initialvalue="0" CssClass="form-control" runat="server">  
     <asp:ListItem Value="0">Please Select a Type</asp:ListItem>    
</asp:DropDownList>

我希望它的工作方式与此类似(除了 asp:dropdownlist):

<asp:TextBox runat="server" required="required"></asp:TextBox>

【问题讨论】:

    标签: asp.net html html5-validation


    【解决方案1】:

    我必须摆脱 {initialvalue="0"} 并设置初始列表项的 {value=""}:

    <asp:DropDownList ID="ExpenseLineTypeDdl" required="required" CssClass="form-control" runat="server">  
          <asp:ListItem Value="">Please Select a Type</asp:ListItem>    
    </asp:DropDownList>
    

    【讨论】:

      猜你喜欢
      • 2014-06-12
      • 2012-03-15
      • 2015-06-04
      • 1970-01-01
      • 2023-03-19
      • 2014-07-07
      • 1970-01-01
      • 2017-12-13
      • 2021-08-01
      相关资源
      最近更新 更多