Hi Friends.,
How to Create a Validation For Text Box Which is Empty in Repeater, it Needs to Throw Value Required Error Message How to Create it
With Regards....,
R.V.Rajagopalan
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajagopalan R VPosted Aug 6, 2014, 7:50 AM
This Validates My Repeater ThanQ All Members And Especially
Jignesh Trivedi
protected bool ValidateRepeaterEmptyCheck()
{
bool result = true;
int count = 0;
TextBox tbx1 = new TextBox();
TextBox tbx2 = new TextBox();
foreach (RepeaterItem dataItem in rptrDetails.Items)
{
tbx1 = (TextBox)dataItem.FindControl("tbx1");
tbx2 = (TextBox)dataItem.FindControl("tbx2");
if (!string.IsNullOrWhiteSpace(tbx1.Text) || !string.IsNullOrWhiteSpace(tbx2.Text))
{
if (string.IsNullOrWhiteSpace(tbx1.Text))
{
count++;
tbx1.BackColor = System.Drawing.Color.DarkOrange;
}
if (string.IsNullOrWhiteSpace(tbx2.Text))
{
count++;
tbx2.BackColor = System.Drawing.Color.DarkOrange;
}
if (count == 0)
{
tbx1.BackColor = System.Drawing.Color.White;
tbx2.BackColor = System.Drawing.Color.White;
}
}
else
{
tbx1.BackColor = System.Drawing.Color.White;
tbx2.BackColor = System.Drawing.Color.White;
}
}
if (count > 0)
{
Master.ShowMessage("Fill Repeater Details", MessageHelper.MessageType.Warning);
result = false;
}
return result;
}
With Regards....,
R.V.Rajagopalan
Rajagopalan R VPosted Jul 31, 2014, 12:44 AM
Thanq For Your Reply Can i Get Even More Clear For This Query , With Clear Solution
With Regards....,
R.V.Rajagopalan
Jignesh TrivediPosted Jul 21, 2014, 1:27 AM
hi,
Please refer below link it might help you.
http://www.chrislord.me/blog/aspnet-validation-control-inside-a-repeater-or-listview/
http://www.aspnetajaxtutorials.com/2010/09/customvalidator-registerexpandoattribut.html
hope this will help you.