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

I want to highlight all the dates that the user chose from the calendar

$
0
0

Hi all,  I want do something like highlighting all the dates that the user chose. From the starting date to the ending date.

This are my codes, how do I modify to make it highlight all the dates that the user chose?

void DayRender(Object sender, DayRenderEventArgs e)
{
string user = (string)Session["UserID"];
string connStr1 = ConfigurationManager.ConnectionStrings["chinastudydbEntities"].ConnectionString;
MySqlConnection conn = new MySqlConnection(connStr1);
conn.Open();
MySqlCommand cmdUser = new MySqlCommand("SELECT * FROM attendance where UserID = '"+user+"'", conn);
MySqlCommand cmdDate = new MySqlCommand("SELECT StartDate from attendance where UserID = '" + user + "'", conn);
MySqlDataReader dr = cmdUser.ExecuteReader();


//using a while loop to read data from the reader
while (dr.Read())
{
DateTime dt = Convert.ToDateTime(dr["StartDate"].ToString());
DateTime dtEnd = Convert.ToDateTime(dr["EndDate"].ToString());
if (e.Day.Date.Date == dt.Date)
{
e.Cell.Controls.Add(new LiteralControl("<br /><label style='color:black'>Leave</label>"));
e.Cell.BackColor = System.Drawing.Color.Red;

}

}
dr.Close();

conn.Close();
}


Viewing all articles
Browse latest Browse all 5678

Trending Articles