zoukankan      html  css  js  c++  java
  • 有现成的RequiredFidldValidator,给你写个示例

    <%@   Page   Language= "c# "   Debug= "true "%>
    <script   language= "C# "   runat= "server ">
    void   Page_Load(Object   Source,   EventArgs   E)  
    {
    }

    void   submit(object   src,EventArgs   e){
    Response.Write( "提交成功! ");
    }
    </script>
    <html>
    <head>
    <title>   Webdiyer   asp.net示例   </title>
    </head>
    <body>

    <form   runat= "server "   method= " ">
    <asp:radiobuttonlist   runat= "server "   id= "rbl ">
    <asp:ListItem   value= "0 "> zero </asp:ListItem>
    <asp:ListItem   value= "1 "> one </asp:ListItem>
    <asp:ListItem   value= "2 "> two </asp:ListItem>
    <asp:ListItem   value= "3 "> three </asp:ListItem>
    </asp:RadioButtonList>
    <asp:RequiredFieldValidator   controlToValidate= "rbl "     errorMessage= "RadioButtonList不能不选 "   runat= "server "/>
    <br>
    <asp:DropDownList   runat= "server "   id= "ddl ">
    <asp:ListItem   value= "0 "> 请选择 </asp:ListItem>
    <asp:ListItem   value= "1 "> one </asp:ListItem>
    <asp:ListItem   value= "2 "> two </asp:ListItem>
    <asp:ListItem   value= "3 "> three </asp:ListItem>
    </asp:DropDownList>
    <asp:RequiredFieldValidator   controlToValidate= "ddl "   initialValue= "0 "   errorMessage= "DropDownList不能选择第一项 "   runat= "server "/>
    <p>
    <asp:Button   runat= "server "   id= "btn "   Text= "提交 "   onclick= "submit "/>
    </form>
    </body>
    </html>
  • 相关阅读:
    iOS
    iOS
    iOS The problems that i encountered
    HTTP STATUS CODE
    MySQL死锁导致无法查询的问题
    JAVA 响应时,按照指定的日期格式返回
    easy额xcel 生成Excel表并返回浏览器弹出下载的简单实现
    Byte数组和字符串相互转换的问题
    Springboot 使用过滤器进行加密解密(二)
    Springboot 部署到linux(二)
  • 原文地址:https://www.cnblogs.com/wangpei/p/1837055.html
Copyright © 2011-2022 走看看