文本框验证失败时出现文本框红色
问题描述:
这里的代码吼我只是显示谁的文本框空了,用户要点击保存那个时候我只是显示请输入波纹管字段和我希望那些文本框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[^]