文本框验证失败时出现文本框红色 [英] appears text box red colour when text box validation fail

查看:231
本文介绍了文本框验证失败时出现文本框红色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里的代码吼我只是显示谁的文本框空了,用户要点击保存那个时候我只是显示请输入波纹管字段和我希望那些文本框atomaticaly以红色显示然后用户可以很容易地找到在他做错的地方请发送代码

here code bellow i just showing whoever text box does empty and user going to click save on that time i just show please enter bellow fields and "" i want those text box atomaticaly appears in red colours" then user can easily find out where he done mistake please send code

if(!string.IsNullOrEmpty(txtmodule.Text) && !string.IsNullOrEmpty(txtparameterType.Text) && (!string.IsNullOrEmpty(txtparameterValue.Text)))
           {
               string APModule = string.Empty;
               string APType = string.Empty;
               string APValue = string.Empty;
               APModule = txtmodule.Text;
               APType = txtparameterType.Text;
               APValue=txtparameterValue.Text;
               bool f_insert = ApplicationParameterBL.Insertdetails(APModule,APType,APValue);
               if (f_insert)
               {
                   ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "alert('Inserted Successfully');", true);
                   FillGrid();
                   btn_AddNew.Visible = true;
                   gridview.Visible = true;
                   pnl_Grid.Visible = true;
                   newtable.Visible = true;
                   txtmodule.Text = "";
                   txtparameterType.Text = "";
                   txtparameterValue.Text = "";
               }
               else
               {

                ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "alert('Failed,Try again');", true);

               }


           }
           else
           {
               string scriptText = "Please Enter The bellow fields,";
               if (string.IsNullOrEmpty(txtmodule.Text))
               {
                   scriptText += "Module:,";
               }
               if (string.IsNullOrEmpty(txtparameterType.Text))
               {
                   scriptText += "ParameterType:,";

               }
               if (string.IsNullOrEmpty(txtparameterValue.Text))
               {
                   scriptText += "Parameter Value:,";
               }
               string[] scriptMessage = scriptText.Split(',');
               string message = string.Empty;
               for (int i = 0; i < scriptMessage.Length; i++)
               {
                   message += scriptMessage[i];
                   message += "\\n";
               }

               ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "alert('" + message + "');", true);
               Pop_up.Show();
           }


       }





我的问题是文本框验证后的失败我想要那些红色的文本框上传者



请任何人可以帮助我



my question is""" after textbox validtion fail""" i want those textbox apperers in red colour

please any one can help me

推荐答案

你可以使用这样的东西...



http://www.jquerybyexample.net/2012/12/jquery-to-check-all-textboxes-empty.html [ ^ ]
You can use something like this...

http://www.jquerybyexample.net/2012/12/jquery-to-check-all-textboxes-empty.html[^]


这篇关于文本框验证失败时出现文本框红色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆