js日期的写法,获取girdviw的行数、提示信息、验证数量信息

//制订日期(js日期的写法)

            var myDate = new Date();

            var theDate = myDate.toLocaleDateString();  //获取今天的日期

            //获取控件选择的日期并进行转换

            var s = ASPxDateEdit1.GetValue();

            var y = new Date(s).getFullYear();

            var m = new Date(s).getMonth() + 1;

            // m = m < 10 ? ('0' + m) : m;

            var d = new Date(s).getDate();

           // d = d < 10 ? ('0' + d) : d;

            var h = new Date(s).getHours();

            var minute = new Date(s).getMinutes();

            // minute = minute < 10 ? ('0' + minute) : minute;

            var dt = y + '/' + m + '/' + d + ' ' + h + ':' + minute;

获取girdviw的行数:

grid_return1.DetailRows.VisibleCount.ToString()

c#写提示信息:

//提示信息

  string ss = "alert('产品信息已经修改!')";

        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "提示", ss, true);

​判断girdviw中两个数量是否大于对方:

int thnum = Convert.ToInt32(e.NewValues["RETRUNNUN"]);  //退货数量

            int lhnum = int.Parse(this.ASPxGridView2.GetRowValues(this.ASPxGridView2.FocusedRowIndex, "COMENUM").ToString());//来货数量

            if (thnum > lhnum)

            {

                e.RowError = "对不起,退货数量只能小于等于来货数量,请正确填写数量!";

            }

​c#中验证提示信息的写法:

//验证提示

        protected void ASPxGridView1_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)

        {

            if (e.NewValues["CHECKNUM"] == null)

            {

                AddError(e.Errors, ASPxGridView1.Columns["CHECKNUM"], "检验合格数量必须填写!");

            }

            if (e.NewValues["NOPASSNUM"] == null)

            {

                AddError(e.Errors, ASPxGridView1.Columns["NOPASSNUM"], "未合格数量必须填写!");

            }

            if (e.Errors.Count > 0) e.RowError = "请按照错误提示操作。";

        }

 

公共验证方法:

void AddError(Dictionary<GridViewColumn, string> errors, GridViewColumn column, string errorText)
{
if (errors.ContainsKey(column)) return;
errors[column] = errorText;
}

posted @ 2015-12-27 14:54  小鹿的无名书  阅读(391)  评论(0编辑  收藏  举报