0

I have two tables Confirm_orders and Tentative Orders that have Start Date and End Date..

How can I implement these dates in calendar in my .aspx page?

All I want is the Start and end date (that represent event dates), to appear in calendar in the from of Red Color.. Those dates must be marked in the calendar, so that the Employee who logs in, can view those Tentative dates and can confirm those dates..

Brad Werth
  • 17,411
  • 10
  • 63
  • 88
Girish
  • 35
  • 1
  • 11
  • Are you trying to display a date picker? – Peter Gluck Aug 16 '12 at 04:31
  • Yes, Date picker.. @hsalama I have 2 tables as I said. The dates represents the training dates From_date to To_date.. I want that dates to appear as marked in Red in calender.. – Girish Aug 16 '12 at 04:36

2 Answers2

0

I'd start by figuring out what calendar control you want to use. There's a million of them, whether you want standard HTML, jQuery, YUI, MooTools, or whatever floats your boat.

ASP.NET has a very basic one built in. You can read about it here. It doesn't require any script or anything and you can manipulate the styles with server side code. The Microsoft AJAX Control Toolkit (Microsoft's more modern web control framework) also has a Calendar control.

Usually when I'm looking for a control that has a certain feature, in your case the ability to highlight certain dates, I find a tutorial or sample that indicates exactly how to do that first. Then I'm not tied down to a certain control. I searched around a bit and found this StackOverflow question that is very similar, using a jQuery based control. Once you read your data from your database, you can write the start and end dates out as JavaScript variables and follow the example from there.

Community
  • 1
  • 1
Mike Christensen
  • 88,082
  • 50
  • 208
  • 326
  • Thanks @Mike.. That was a great help.. I just want a basic Calender that highlights the dates that is in my database. I am using this [link](http://msdn.microsoft.com/en-us/library/ms228044.aspx) Not able to make it though but thanks for the suggestions.. – Girish Aug 16 '12 at 05:14
  • @Girish - That looks like a good start! What specific problem are you having with their example? – Mike Christensen Aug 16 '12 at 05:21
  • @Mike.. I have used the same codes for testing, but the dates doesn't appear in the Calender.. Can I post this as a different question? – Girish Aug 16 '12 at 05:24
  • Sure. Post a new question, link to the example you've provided, and show the code you've tried. Explain what went wrong and what you expect to see, include as much detail as possible. – Mike Christensen Aug 16 '12 at 05:26
  • Here it is- [my question](http://stackoverflow.com/questions/11981195/bind-dates-from-database-table-to-asp-net-calender) – Girish Aug 16 '12 at 05:40
-1

You need to use a javascript DatePicker. There is no built-in C# HTML helper that displays a calendar.

Peter Gluck
  • 8,168
  • 1
  • 38
  • 37
  • There actually *is* an [ASP.NET one](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar(v=vs.80).aspx).. – Mike Christensen Aug 16 '12 at 04:48
  • @MikeChristensen Wow so kool. Thanks for this.. But now please tell me as to how to bind this Calender to the dates mentioned in my Database table? – Girish Aug 16 '12 at 04:51
  • @MikeChristensen Yikes! Where was that when I needed it? I stand corrected. Thanks. – Peter Gluck Aug 16 '12 at 04:52
  • I think that one is the old school original ASP.NET postback-heavy control. The Microsoft AJAX Control Toolkit also has a [calendar control](http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx) that might be more modern. Though I'm sure there's roughly 8 million ones built on jQuery as well. – Mike Christensen Aug 16 '12 at 04:55
  • Yeah, I've always used the jQuery date picker. – Peter Gluck Aug 16 '12 at 04:56
  • @Girish - I don't know how to do that since I don't know your code or where your data comes from. If you want to *highlight* a date range in red, I'd probably dig through the docs and tutorials of various calendar controls and find one that makes that feature really easy or has that as an example. – Mike Christensen Aug 16 '12 at 04:58
  • Implementing it on textbox is fine.. But my question is how do I bind my dates to database? – Girish Aug 16 '12 at 04:58