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>
  • 相关阅读:
    Python字符串学习相关问题
    Python函数学习遇到的问题
    How to configure ODBC DSN to access local DB2 for Windows
    如何在Eclipse CDT中编译含有多个main函数的项目
    MakeFile 文件的作用
    云技术:负载均衡SLB
    云技术:弹性计算ECS
    《老罗的Android之旅》导读PPT
    服务器集群负载均衡技术
    杭电ACM 1004题
  • 原文地址:https://www.cnblogs.com/wangpei/p/1837055.html
Copyright © 2011-2022 走看看