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>
  • 相关阅读:
    网易官方」极客战记(codecombat)攻略-沙漠-跟上时间-keeping-time
    jenkins 通过使用crumbissuer停止job
    获取crumbIssuer
    解决docker容器vim高度宽度显示不正常
    嵌入skype标签
    pip --user参数
    python requests模块和 urllib.request模块
    python字符识别
    bs4解析xml文件,制作xml文件
    jenkins api
  • 原文地址:https://www.cnblogs.com/wangpei/p/1837055.html
Copyright © 2011-2022 走看看