Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in repeater control validate date must not same date and selected date of one course is the next date of another course.

Repeater control as follows

RPST    29 Apr 14 
RFPFF  29 Apr  14

C#
string strdt = string.Empty;
foreach(RepeaterItem ri in rptCart1.Items)
{
    CheckBox cbox = (CheckBox)ri.FindControl("chk");
    if (cbox.Checked = true)
    {
        HiddenField lbl = (HiddenField)ri.FindControl("hdDate");
        strdt = strdt + lbl.Value + ",";
    }
}

string[] strRdate = strdt.Split(',');
if (strRdate.Length > 2)
{
    if (strRdate[0] == strRdate[1])
    {
          Response.Redirect("ShiftConfirmation.aspx");
    }
    else
    {
          Label23.Visible = true;
          Label23.Text = "RPST and RFPFF date must not be same. And RPST Date is the next date of RFPPF Date";
    }
}


i want to check two validation the RPST and RPSCRB date must not be same date.
And RPST Date is the next date of RFPFF Date.
from my above code what changes i have to be made.

I want the output to be as follows (RPST date is the next date of RFPFF Date)
RPST    29 APR 14
RFPFF  30 APR 14


for the above outptut how can i validate in asp.net using c#.


[Edit member="Tadit"]
Added pre tags.
[/Edit]
Posted
v2
Comments
ZurdoDev 25-Apr-14 12:12pm    
Where are you stuck? It sounds like you are just asking a logic question which tells me you just need to walk through your code to make sure you understand it right.
gggustafson 25-Apr-14 13:24pm    
Why not add one day to RPST and validate using that?

DateTime RPST = new DateTime ( 2014, 4, 29 );
DateTime RFPFF = RPST.AddDays ( 1.0 ).Date;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900