I want to Generate Calendar in c#.net to enter daily attendance.I have used jquery calendar for similar purpose in web. Is there any ways to create calendar control and get click event to mark and display values in that.
Thanks
Example image:
I want to Generate Calendar in c#.net to enter daily attendance.I have used jquery calendar for similar purpose in web. Is there any ways to create calendar control and get click event to mark and display values in that.
Thanks
Example image:
If you have a budget I would definitely go for a commercial component like Telerik's Scheduler Control. That will cost $999 for the collection, I've never used Telerik's controls before so I can't recommend them myself but by the looks it could be well worth it in the long run if you can reuse the components in other projects.
If that isn't an option, something as simple as your example would be fairly easy to roll yourself. I mainly work in WinForms so this is how I would go about building the form:
FlowLayoutPanel
and set Dock
to Fill
. This will contain the 'day' controls, which will flow left to right, top to bottom.Now you need to be working in code, not the designer. This could probably be done in the constructor, the Page_Load
handler, or somewhere that gets called when the month/year is set (or initialised):
FlowLayoutControl
to pad out the start of the month. You can find out how many to add with new DateTime(year, month, 1).DayOfWeek
to find the day that the first of the month falls on. The empty panels should be set to the same size as the 'day' control.day
control to the FlowLayoutControl
for each day in the month. Use DateTime.DayInMonth(year, month)
to find the number of days in the selected month, and set each 'day' control up with the date (and probably the in/out data) as you're adding it.flowLayoutControl.Items.Clear()
in the setup code.That should result in a control that can dynamically display any month. To add the attendance editing feature, set up a Click
handler either in the 'day' control or in the calendar control itself (when you're adding the 'day' controls to the FlowLayoutControl
, and open up a modal form to edit or add the in/out times for the selected day.
If you wanted the day controls to resize dynamically register for the containing control's Resize
event and set the width and height of each day control to Math.Floor(control.Width / 7)
(seven days wide) and Math.Floor(control.Height / 5)
(five weeks high) or something similar.
As far as I know, there is no a standard schedule control on the market. I would suggest that you take a look at the XtraSchedule control from DevExpress.