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>
  • 相关阅读:
    layer满屏/禁止最大化最小化 可以做选择框使用
    layer关闭弹窗
    导出excel
    linux中安装软件的集中方法
    nginx负载均衡
    zookeeper部署搭建
    git 分支合并处理
    前端框架
    云计算基本概念
    Android 单元测试四大组件Activity,Service,Content Provider , Broadcast Receiver
  • 原文地址:https://www.cnblogs.com/wangpei/p/1837055.html
Copyright © 2011-2022 走看看