如题?只要后台判断而不是前台!

解决方案 »

  1.   

    private bool Check(string  str)
    {
    try
    {
       int i = Convert.ToInt32(str);
       if (i > 0)
         return true;
    }catch(Exception exp)
    {
    }return false;
    }
      

  2.   

    string strnum ; //你接收的数字符串 try
    {
       if(int.prase(strnum)) > 0
       {
         return 1;
       }
       else
         return 0;
    }
    catch
    {
       return 0;
    }
      

  3.   

    trystring yourStr = ............;
    if (Regex.IsMatch(yourStr, @"^[1-9][0-9]*$"))
    {
        //正整数
    }
    else
    {
        //其它
    }
      

  4.   

    引入microsft.visualbase名称空间 有 Isnumeric方法
      

  5.   

    to lxcnn(过客) ( );
    ----------------------------
    编译错误 
    说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0103: 当前上下文中不存在名称“Regex”源错误: 行 206:    protected void TurnToPage_Click(object sender, EventArgs e)
    行 207:    {
    行 208:        if (Regex.IsMatch(ReturnPage.Text, @"^[1-9][0-9]*$"))
    行 209:        {
    行 210:            CurrrentPage2.Value = (int.Parse(ReturnPage.Text) - 1).ToString();
     源文件: e:\3g\PMenu.aspx.cs    行: 208 
      

  6.   

    引入命名空间
    using System.Text.RegularExpressions;
      

  7.   

    可以使用正则表达式:
    ^(214748364[0-7])$|^(21474836[0-3]\d)$|^(2147483[0-5]\d{2})$|^(214748[0-2]\d{3})$|^(21474[0-7]\d{4})$|^(2147[0-3]\d{5})$|^(214[0-6]\d{6})$|^(21[0-2]\d{7})$|^(2[0]\d{8})$|^([0-1]\d{9})$|^(\d{1,9})$  
    -------------------------------------------
    MSN:[email protected] 
    请给我与您交流的机会
      

  8.   

    以上表达式是按严格按照正整数的定义写的,你可以参考一下。
      
    -------------------------------------------
    MSN:[email protected] 
    请给我与您交流的机会