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?
Date/TImePicker available in windows forms, not web forms....What to do....
Page 1 of 1
8 Replies - 2832 Views - Last Post: 06 February 2010 - 02:37 PM
#1
Date/TImePicker available in windows forms, not web forms....
Posted 06 February 2010 - 09:40 AM
Replies To: Date/TImePicker available in windows forms, not web forms....
#2
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
http://www.codeproje...TimePicker.aspx
This post has been edited by CharlieMay: 06 February 2010 - 10:22 AM
#3
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.
#4
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.
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.
#5
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..
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..
#6
Re: Date/TImePicker available in windows forms, not web forms....
Posted 06 February 2010 - 11:34 AM
MKunstman, 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..
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...
#7
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...
#8
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
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))
#9
Re: Date/TImePicker available in windows forms, not web forms....
Posted 06 February 2010 - 02:37 PM
CharlieMay, on 06 February 2010 - 01:15 PM, said:
Use TimeSpan to get the difference between two dates.
Here's an example
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.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|