zoukankan      html  css  js  c++  java
  • C#中后台申明全局变量来判断某一特定值的代码

    i f (CheckData())
            {
                return;
            }
     Boolean flag = false;
            if (rep_item_list.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(Page, GetType(), "popUp", "alert('产品明细不能为空!');", true);//判断产品明细是否为空
                flag = true;
                return flag;
            }
            else
            {
                for (int i = 0; i < rep_item_list.Rows.Count; i++)
                {
                    if ((((DropDownList)rep_item_list.Rows[i].FindControl("drpImdeGoodsID")).SelectedItem.Value) == "-1")//判断产品名称是否为空
                    {
                        ScriptManager.RegisterStartupScript(Page, GetType(), "popUp", "alert('请输入第" + (i + 1) + "行产品名称!');", true);
                        ((DropDownList)rep_item_list.Rows[i].FindControl("drpImdeGoodsID")).Focus();
                        flag = true;
                        return flag;
                    }
                    if (((TextBox)rep_item_list.Rows[i].FindControl("txtImdeQuantity")).Text.Trim().Equals(String.Empty))//判断数量是否为空
                    {
                        ScriptManager.RegisterStartupScript(Page, GetType(), "popUp", "alert('请输入第" + (i + 1) + "行数量!');", true);
                        ((TextBox)rep_item_list.Rows[i].FindControl("txtImdeQuantity")).Focus();
                        flag = true;
                        return flag;
                    }
                    Regex r = new Regex("^[0-9]{1,}$");        //判断是否数字
                    if (!r.IsMatch(((TextBox)rep_item_list.Rows[i].FindControl("txtImdeQuantity")).Text))      //txtImdeQuantity.Text 这个是要判断的值
                    {
                        ScriptManager.RegisterStartupScript(Page, GetType(), "popUp", "alert('数量必须为数字!');", true);
                        ((TextBox)rep_item_list.Rows[i].FindControl("txtImdeQuantity")).Focus();
                        ((TextBox)rep_item_list.Rows[i].FindControl("txtImdeQuantity")).Text = "";
                        flag = true;
                        return flag;
                    }
                }
                return flag;
            }
  • 相关阅读:
    Anaconda使用命令
    排序算法3--插入排序--希尔排序(缩小增量排序)
    排序算法2--插入排序--折半插入排序
    排序算法1--插入排序--直接插入排序
    排序总结---常用的排序算法总结,java和js实现
    前端兼容性问题
    js对象的几种创建方式和js实现继承的方式[转]
    js原型和原型链[转]
    性能优化的方法
    Http状态码
  • 原文地址:https://www.cnblogs.com/QiuJL/p/4524295.html
Copyright © 2011-2022 走看看