I want to display "time in,time out & status" columns into Calendar.... This is the Back-Code for calendar:
C#
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { DataSet ds = GetData(); //string link = " string s = e.Day.Date.ToShortDateString(); e.Cell.Text = e.Day.Date.Day.ToString() + "
"; LiteralControl l = new LiteralControl(); l.Text = e.Day.Date.Day.ToString() + "
"; e.Cell.Controls.Add(l); foreach (DataRow row in ds.Tables[0].Rows) { string Transaction_date = Convert.ToDateTime(row["transaction_date"]).ToShortDateString(); if (Transaction_date.Equals(s)) { LinkButton lb = new LinkButton(); lb.Text = "IN:" + row["actual_time_in"] as String + "
" + row["actual_time_out"] as String + row["status"] as String + "" + "
"; e.Cell.Controls.Add(lb); } }Java
private DataSet GetData() { SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["conString"].ConnectionString); SqlDataAdapter ad = new SqlDataAdapter("CalendarAttendance", myConnection); DataSet ds = new DataSet(); ad.Fill(ds); return ds; }@status varchar(5), @transaction_date datetime, @actual_time_in datetime, @actual_time_out datetime
SQL
AS BEGIN SET NOCOUNT ON; SELECT actual_time_in=@actual_time_in, actual_time_out=@actual_time_out, status=@status FROM tblschedule where Employeeid = @Employeeid END
ali tuncerRank #1,499 · 1.1K reputationPosted May 4, 2016, 6:51 AM EDT
FROM tblschedule where Employeeid = @Employeeid
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@Employeeid", SqlDbType.Int).Value = 1 //here you pass employee id
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
Viraj Kawthankar22 reputationPosted May 5, 2016, 1:24 AM EDT
" + "OUT:" + row["actual_time_out"] as String + "
" + "WR_HRS:" + row["status"] as String + "" + "
";
ali tuncerRank #1,499 · 1.1K reputationPosted May 5, 2016, 1:45 AM EDT
Do you have data in your dataset (ds) ?
Viraj Kawthankar22 reputationPosted May 5, 2016, 3:25 AM EDT
ali tuncerRank #1,499 · 1.1K reputationPosted May 5, 2016, 4:06 AM EDT
Viraj Kawthankar22 reputationPosted May 5, 2016, 9:39 PM EDT
ali tuncerRank #1,499 · 1.1K reputationPosted May 5, 2016, 11:43 PM EDT
Why do you need to pass time_in,time_out,status?
I think you only need to pass employee id as parameter and you will retrieve his/her time_in, time_out,status, Isn't that right?
Viraj Kawthankar22 reputationPosted May 5, 2016, 11:57 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts