Repeater rptdates = new Repeater();
rptdates = (Repeater)rpt1.Items[e.Item.ItemIndex].FindControl("rptLevel2");
string BatchDates="";
string dates = "";
DropDownList ddllist = new DropDownList();
LinkButton LnkLevel2 = new LinkButton();
int flag = 0;
string PKGMinorCode = "";
for (int i = 0; i < rptdates.Items.Count; i++)
{
ddllist = (DropDownList)rptdates.Items[i].FindControl("ddlDate");
BatchDates = BatchDates + ddllist.SelectedValue.ToString().Trim() + "+";
dates += ddllist.SelectedItem.Text.ToString() + ",";
LnkLevel2 = (LinkButton)rptdates.Items[i].FindControl("lnkLevel2");
PKGMinorCode += LnkLevel2.CommandArgument.ToString().Trim() + ",";
}
string[] Coursecheck;
datecheck = dates.Split(',');
Coursecheck = PKGMinorCode.Split(',');
int len = datecheck.Length;
for (int z = 0; z < len-1; z++)
{
for (int j = z + 1; j < len-1 ; j++)
{
if (Coursecheck[z] == "RPSCRB" && Coursecheck[j] == "R-AFF")
{
if (datecheck[z] != datecheck[j])
{
ScriptManager.RegisterStartupScript(this, GetType(), "Invalid date", "alert('RPSCRB and R-AFF Dates must not be the same date')", true);
return;
}
}
in run mode i select the AFF Date after than PSCRB Date that time message shows
PSCRB Date must be preceding to AFF Date
From my above code how can i do?
AFF Date in dropdownlist as follows;
16 May 2013
PSCRB Date in Dropdownlist as follows;
19 May 2013
if (datecheck[z] != datecheck[j])
in the above line how can i check PSCRB Date must be preceding to AFF Date
Output i want as follows;
AFF Date in dropdownlist as follows;
15 May 2013
PSCRB Date in Dropdownlist as follows;
14 May 2013
Please help me
Regards,
Narasiman P.