note it is windows application.
Holiday Reason(table Name Leave)
20/2/2013 Labour Day
25/2/2013 Holiday
When i select the calendar that month all dates will display in datagridview using csharp.
And also user did not able to select the sunday date in that month.
for the above two condition i written a code as follows;
DGVCalendar.Rows.Clear();
DateTime dt1 = Faculty_Available_Calendar.SelectionStart;
dt1 = new DateTime(dt1.Year, dt1.Month, 1);
DateTime dt2 = dt1.AddMonths(1);
int numDays = (dt2 - dt1).Days;
if (DGVCalendar.RowCount < numDays)
{
DGVCalendar.RowCount = numDays;
}
int row = 0;
while (dt1 < dt2)
{
DGVCalendar.Rows[row].Cells[1].Value = dt1.ToString("dd-MMM-yyyy");
DGVCalendar.Rows[row].Cells[0].Value = true;
if (dt1.DayOfWeek == DayOfWeek.Sunday)
{
DGVCalendar.Rows[row].ReadOnly = true;
DGVCalendar.Rows[row].Cells[0].Value = false;
DGVCalendar.Rows[row].Cells[0].Style.BackColor = Color.Orange;
DGVCalendar.Rows[row].Cells[1].Style.BackColor = Color.Orange;
DGVCalendar.Rows[row].Cells[2].Style.BackColor = Color.Orange;
DGVCalendar.Rows[row].Cells[2].Value = "Sunday";
}
dt1 = dt1.AddDays(1);
row++;
}
I want to check another condition selected date in datagridview is present in another Table.
if user select the 20/2/2013 (the above date in datagridview) using checkbox user select the 20/2/2013 Date shows the message "select date is not allowed"
Because that date is in Leave Table.
for that how to validate.
please help me.
How can i do,please help me,how can i do,tell me the answer.
Regards,
Narasiman P.
note it is windows application.