Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Need help regarding the calendar!

$
0
0

Hi all, I have a calendar in my project. I want to make it like when the user chose a date that is before today's date, button 1 will disappear. I also want the button to disappear when there is already a booking inside. How do I do that? I have done some of my codes but it does not seem to be working. How do I solve those error?

This is my codes :

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
string now = Calendar1.SelectedDate.ToString("yyyy-MM-dd");
DateTime current = DateTime.Now;
DateTime MyDateTime;
MyDateTime = new DateTime();
MyDateTime = DateTime.ParseExact(now, "yyyy-MM-dd",null);
Label15.Text = Calendar1.SelectedDate.ToString("MM-dd-yyyy");
TextBox1.Text = Label15.Text;
string user = (string)Session["UserID"];
Label12.Text = "";
Label13.Text = "";
Label14.Text = "";
string mySQL;
MySqlConnection connDate = new MySqlConnection(connStr);
connDate.Open();
mySQL = "Select StartDate, EndDate, Reason from attendance where UserID = '" + user + "' and StartDate = '" +now+"'";
MySqlCommand cmdDate = new MySqlCommand(mySQL, connDate);
MySqlDataReader dr = cmdDate.ExecuteReader();


//using a while loop to read data from the reader
while (dr.Read())
{
Label12.Text = dr["StartDate"].ToString().Trim();
Label13.Text = dr["EndDate"].ToString().Trim();
Label14.Text = dr["Reason"].ToString().Trim();
string date = Label12.Text;

if (MyDateTime < current)
{
Button1.Visible = false;
}

}
dr.Close();
Panel2.Visible = true;
connDate.Close();

}


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>