How to create festival calendar in ASP.net
Posted
by
Atul
on Stack Overflow
See other posts from Stack Overflow
or by Atul
Published on 2011-09-14T05:59:39Z
Indexed on
2012/09/25
3:38 UTC
Read the original article
Hit count: 136
I want to make a festival calendar using asp.net from that I used two ajax calendar and one textbox it is a festival textbox where we enter festival which FromDate and ToDate respectively. I want to do this as following point
If I enter in textbox Christmas and Choose Fromdate=25/12/2011 and ToDate=31/12/2011 then it will be valid
If I choose fromDate=25/12/2011 and ToDate=24/12/2011 then it will invalid
If I choose Fromdate=25/12/2011 and Todate=28/12/2011 then also it is invalid because it coming in between 25/12/2011 and 31/12/2011
If I Choose fromdate=1/1/2011 and ToDate=1/1/2011 then it is valid
If I choose fromdate=21/12/2011 and 25/12/2011 then it is invalid because of already Christmas done in 1/1/2011
And all date should show in gridview like 25-dec-2011 format
Here is my code:
DateTime dt1 = Convert.ToDateTime(txt_fromdate.Text);
DateTime dt2 = Convert.ToDateTime(txt_todate.Text);
if (dt1 > dt2)
{
con.Open();
com = new SqlCommand("BTNN_MovieDB_Festival_Details_Insert", con);
com.Parameters.Add("@fromdate", SqlDbType.VarChar).Value = dateformat_mmdd(txt_fromdate.Text.ToString().Trim());
com.Parameters.Add("@todate", SqlDbType.VarChar).Value = dateformat_mmdd(txt_todate.Text.ToString().Trim());
com.Parameters.Add("@return", SqlDbType.VarChar).Direction = ParameterDirection.ReturnValue;
com.ExecuteNonQuery();
con.Close();
showdata();
}
else if (dt1 < dt2)
{
lblerror.Text = "ToDate should be greater than FromDate";
}
© Stack Overflow or respective owner