if (DrpEvRepeats.SelectedValue == "Weekly")
{
int Weekly = Convert.ToInt32(DrpRptWeekly.SelectedValue);
TimeSpan WeeklyDifference = Convert.ToDateTime(txtWeeklyEnd.Text.Substring(6, 4) + "/" + txtWeeklyEnd.Text.Substring(3, 2) + "/" + txtWeeklyEnd.Text.Substring(0, 2) + " " + drpHHEnd.SelectedValue + ":" + drpMMEnd.SelectedValue) - Convert.ToDateTime(txtStartDate.Text.Substring(6, 4) + "/" + txtStartDate.Text.Substring(3, 2) + "/" + txtStartDate.Text.Substring(0, 2) + " " + drpHHStart.SelectedValue + ":" + drpMMStart.SelectedValue);
foreach (RepeaterItem rpI in rptEvRepeat.Items)
{
for (int i = 0; i <= Convert.ToInt32((Convert.ToInt32(WeeklyDifference.TotalDays)) / 7); i += Weekly)
{
DataRow objDR = dtEvRepeat.NewRow();
objDR["SrNo"] = "";
//string rptOn = "";
//for (int j = 0; j < chkRptOn.Items.Count; j++)
//{
// if (chkRptOn.Items[j].Selected)
// rptOn += chkRptOn.Items[j].Value + ",";
//}
//rptOn = rptOn.TrimEnd(',');
if (txtStartDate.Text != "")
objDR["StartDate"] = Convert.ToDateTime(txtStartDate.Text.Substring(6, 4) + "/" + txtStartDate.Text.Substring(3, 2) + "/" + txtStartDate.Text.Substring(0, 2) + " " + drpHHStart.SelectedValue + ":" + drpMMStart.SelectedValue).AddDays(i * 7);
else
objDR["StartDate"] = "";
if (txtEndDate.Text != "")
objDR["EndDate"] = Convert.ToDateTime(txtEndDate.Text.Substring(6, 4) + "/" + txtEndDate.Text.Substring(3, 2) + "/" + txtEndDate.Text.Substring(0, 2) + " " + drpHHEnd.SelectedValue + ":" + drpMMEnd.SelectedValue).AddDays(i * 7);
else
objDR["EndDate"] = "";
dtEvRepeat.Rows.Add(objDR);
}
}
}