9
Answers

Displaying Table Data in Calendar Asp.net C#

Viraj Kawthankar

Viraj Kawthankar

8y
498
1
I want to display "time in,time out & status" columns into Calendar.... This is the Back-Code for calendar:
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { DataSet ds = GetData(); //string link = "<a href='ScheduleDetails.aspx?scheduleID="; string s = e.Day.Date.ToShortDateString();      e.Cell.Text = e.Day.Date.Day.ToString() + "<BR>"; LiteralControl l = new LiteralControl();     l.Text = e.Day.Date.Day.ToString() + "<BR>";     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 + "<BR>" + row["actual_time_out"] as String + row["status"] as String + "</a>" + "<BR>";             e.Cell.Controls.Add(lb); } }
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; }
This is the stored Procedure:"CalendarAttendance" ALTER PROCEDURE [dbo].[CalendarAttendance] @Employeeid int,
@status varchar(5), @transaction_date datetime, @actual_time_in datetime, @actual_time_out datetime
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
Im getting an error : Procedure or function 'CalendarAttendance' expects parameter '@Employeeid', which was not supplied. I want the Calendar to display time_in,time_out & status according to respective days and of that employee who has logged in. Plz correct the code & Stored Procedure wherever necessary.. 

Answers (9)