1
Answer

Validate the course name in repeater control in Asp.net

narasiman rao

narasiman rao

10y
601
1
 
   In Repeater Control as follows
 
CourseName    CourseDate    Amount
RAFF                29 Jun 14          500
RFPFF               30 Jun 14        600

Submit (Button)
 
In the above repeater control i want to validate RPST course must be there in the repeater control. 
 
if RPST course is not there in the repeater control i want to show the message "RPST course must be there".
 
In the above repeater control RAFF and RFPFF course is there. But RPST course is not there in repeater control.
 
When user clicks the Submit Button i want to validate RPST course must be there.
 
For that i written a code as follows
 
if (rptCart1.Items.ToString().Trim() != "RAFF")
{
Label23.Text = "RAFF Course must be there";
}
 
else if (rptCart1.Items.ToString().Trim() != "RFPFF")
{
Label23.Text = "RFPFF course must be there";

}
 
else if (rptCart1.Items.ToString().Trim() != "RPST")
{
Label23.Text = "RPST Course must be there";
}
 
In repeater control both the courses RAFF and RFPFF course is there. Only RPST course is not there.
But when i click the submit button message shows "RAFF Course must be there".
 

But in the repeater control RAFF course is there. RPST course only is not there.
 
from my above code what is the mistake i made.please help me.
Answers (1)