8 Replies - 3332 Views - Last Post: 06 February 2010 - 02:37 PM Rate Topic: -----

#1 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 09:40 AM

So here is the problem I have today. I am working on an assignment and just making my way all la de da like...suddenly I approach the end and I am rather happy since I then can start finals. This is where the problem arrises...This is what I am required to do...

 Create a Web user control that has text boxes and labels for inputting a person's
information.
 Integrate a DateTimePicker control in the web page for selecting dates.
 Create a procedure to calculate the number of days elapsed from the order date to
the estimated shipping date.

I have the first part easily completed...no problems..Unfortunately the second part...the DateTimePicker control, since I am working on a web page, is not available to me...unless I have missed something but I can guarantee you it does not show up in the control box of Visual Studio 2008 when working on a web page...any suggestions?

Is This A Good Question/Topic? 0
  • +

Replies To: Date/TImePicker available in windows forms, not web forms....

#2 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,914
  • Joined: 25-September 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 10:21 AM

Could you do this to appease that step? (it does after-all say to "Integrate")

http://www.codeproje...TimePicker.aspx

This post has been edited by CharlieMay: 06 February 2010 - 10:22 AM

Was This Post Helpful? 1
  • +
  • -

#3 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 10:38 AM

This looks like what I need though I cannot seem to get the code...I'm a little greener then this would assume so that added to the amount of frustration in having little to no guidance from the professor has created a dummy me for the moment. My original thought was to use two CalendarExtender tools and just compare the data selected but I am having quite a bit of trouble finding reference materials to learn to do so, and the book is less than enlightening in covering such topics.
Was This Post Helpful? 0
  • +
  • -

#4 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,914
  • Joined: 25-September 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 10:50 AM

Well, I've not messed much with Webforms. But what I just tried appeared to work.

I added a textbox, a button and a calendar control. Set the calendar to visible = false, set the textbox1.text = to todays date. I then added code to the button_click to make the calendar visible and in the selection change event I added code to set the textbox1.text to equal the selected date.
Was This Post Helpful? 0
  • +
  • -

#5 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 10:59 AM

As I am working right now, I am creating a table with two calendars. I know its not exacly the nicest looking but I think it will get the job done. Because for the assignment I have to have those two selected dates, and then compare them to show either the distance between the dates, or that the order date needs to be today or later type error. So I just need to figure out...would I make a procedure in the vb portion for like...getSelectedDate() from each calendar? and then just a

if selected date calendar1 < calendar2 then
the distance between dates is blah blah
else if selected date calendar1 > calendar2 then
delivery cannt be before order
else if selected date calendar1 before Now.toshortSring then
order date cannot be prior to today

That kind of thing..
Was This Post Helpful? 0
  • +
  • -

#6 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 11:34 AM

View PostMKunstman, on 06 February 2010 - 09:59 AM, said:

As I am working right now, I am creating a table with two calendars. I know its not exacly the nicest looking but I think it will get the job done. Because for the assignment I have to have those two selected dates, and then compare them to show either the distance between the dates, or that the order date needs to be today or later type error. So I just need to figure out...would I make a procedure in the vb portion for like...getSelectedDate() from each calendar? and then just a

if selected date calendar1 < calendar2 then
the distance between dates is blah blah
else if selected date calendar1 > calendar2 then
delivery cannt be before order
else if selected date calendar1 before Now.toshortSring then
order date cannot be prior to today

That kind of thing..

So I did as I said...created two calendars in a table...I have it working...though two problems I have...first, it never makes it past the first if statement, it just always reports the delivery date as it is selected...here s the code:

 Dim orderDate As Date
    Dim shipDate As Date

    Protected Sub Calendar1_Selectionchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.Selectionchanged
        orderDate = Calendar1.SelectedDate
    End Sub

    Protected Sub Calendar2_Selectionchanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar2.Selectionchanged
        shipDate = Calendar2.SelectedDate
        compareDates()
    End Sub

    Private Sub compareDates()
        If orderDate < shipDate Then
            lblOutput.Text = "Your order should arrive on " & shipDate
        ElseIf orderDate > shipDate Then
            lblOutput.Text = "Arrival Date must be later than today's date."
        ElseIf orderDate < Today() Then
            lblOutput.Text = "Order date needs to be later than today's date."
        End If
    End Sub


second, I want to show the numerical distance between days as well as the arrival date when it calculates. If that is possible...
Was This Post Helpful? 0
  • +
  • -

#7 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 01:02 PM

After re reading things, I just have to figure out now how to turn the above code into a statement to fine the numerical difference between days....frustration has me pinched at the moment...any vague brainstorms welcome...
Was This Post Helpful? 0
  • +
  • -

#8 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,914
  • Joined: 25-September 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 02:15 PM

Use TimeSpan to get the difference between two dates.

Here's an example
Dim date1 As Date = #1/1/2010#
        Dim date2 As Date = #1/5/2010#
        Dim days As Integer = 0
        Dim span As New TimeSpan
        span = date2 - date1
        MessageBox.Show(CStr(span.Days))


Was This Post Helpful? 1
  • +
  • -

#9 MKunstman  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 193
  • Joined: 26-October 09

Re: Date/TImePicker available in windows forms, not web forms....

Posted 06 February 2010 - 02:37 PM

View PostCharlieMay, on 06 February 2010 - 01:15 PM, said:

Use TimeSpan to get the difference between two dates.

Here's an example
Dim date1 As Date = #1/1/2010#
        Dim date2 As Date = #1/5/2010#
        Dim days As Integer = 0
        Dim span As New TimeSpan
        span = date2 - date1
        MessageBox.Show(CStr(span.Days))


Finally! haha great thinking I really appreciate all the help today...so frustrating when your professors are apparently unavailable for two weeks......Thanks again I really can't tell you how helpful you have been.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1