微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

NumericUpDownExtender

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>NumericupdownExtender</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
          Enter a numeric value and use
         <br />
         the up and down buttons to increment/decrement &nbsp; &nbsp; &nbsp;<asp:TextBox ID="TextBox1"
            runat="server">0</asp:TextBox>
        <br />
          <br />
           Choose your favorite month &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
         <br />
            Let the web service pick a random number
           <br />
            between 0 and 1000 that is higher/lower
          <br />
            than the displayed value &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
           &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp;
           <asp:TextBox ID="TextBox3" runat="server">0</asp:TextBox><br />
           <br />
           Use the arrow images to increment/decrement &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
           &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
           &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
            <br />
             the value &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            <asp:TextBox ID="TextBox4" runat="server" ></asp:TextBox>
            <asp:ImageButton ID="ImageButton2" runat="server" Width="15px" Height="15px" ImageUrl="~/up.gif" />
            &nbsp;
            <br />
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            <asp:ImageButton ID="ImageButton1" runat="server" Width="15px" Height="15px" ImageUrl="~/down.gif" /><br />
               <cc1:NumericupdownExtender ID="NumericupdownExtender1" TargetControlID="TextBox1" Width="150"    runat="server">
            </cc1:NumericupdownExtender>
            <cc1:NumericupdownExtender ID="NumericupdownExtender2" TargetControlID="TextBox2" Width="150" RefValues="January;February;march;April;May;June;July;August;September;October;November;December" runat="server">
            </cc1:NumericupdownExtender>
            <cc1:NumericupdownExtender ID="NumericupdownExtender3" TargetControlID="TextBox3" Width="150" ServiceUpPath="WebService1.asmx" ServiceUpMethod="NextNumber" ServiceDownPath="WebService1.asmx" ServiceDownMethod="PreNumber" runat="server">
            </cc1:NumericupdownExtender>
            <cc1:NumericupdownExtender ID="NumericupdownExtender4" TargetControlID="TextBox4" Width="150" TargetButtonUpID="ImageButton2" TargetButtonDownID="ImageButton1" runat="server">
            </cc1:NumericupdownExtender>
    </div>
    </form>
</body>
</html>


=======webservers=====

 

[WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.Web.Script.Services.ScriptService]
   // [ToolBoxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {
               [WebMethod]
      public int NextNumber(int current,string tag)
        {
            Random r1 = new Random();
            return r1.Next(Math.Min(Math.Max(0,current),1000),1001);
  
        }
        [WebMethod]
        public int PreNumber(int current,string tag)
        {

            Random r2 = new Random();            return r2.Next(0,Math.Min(Math.Max(0,1000));        }    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐