Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 28th, 2006, 12:56 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help - I'm Completely Stuck

Hello everyone and thanks for your help in advance. I am working on a scheduling application for a physician. The work in progress can be viewed at http://www.kidsmedicalcare.com/schedule2.aspx. Where I am running into problems is when a date is clicked on the calendar, the appointments for the day should be loaded. What seems to be happening is that when a date with appointments is clicked, the appointments appear correctly, but then do not disappear properly when another date is clicked. Here are some code snippets:

The appointment grid is built by a sub routine called LoadTable(). Basically, it adds rows and cells to a table with hyperlinks corresponding to the date and time of the appointment. The current date with a starting time of 8:00 am is passed to the sub. The routine assigns an ID value to each hyperlink corresponding with the date and time, to be referenced by the GetAppointments() routine later.


Public Sub LoadTable(ByVal StartTime As DateTime)
tblAppointments.Controls.Clear()


Dim EndTime As DateTime = StartTime.ToShortDateString & " 5:00:00 pm"
ltlDate.Text = "Appointments for: <br>" & StartTime.ToShortDateString & " " & StartTime.ToShortTimeString


Dim ProviderCount As Integer

Do While StartTime < EndTime
StartTime = StartTime.AddMinutes(10)


'Add Label Column

Dim TimeLabel As New TableCell
TimeLabel.Text = StartTime.ToShortTimeString

TimeLabel.Text = StartTime.ToString


'Add Time Row

Dim TimeRow As New TableRow
TimeRow.Cells.Add(TimeLabel)


'Add Provider Cells

For ProviderCount = 1 To 3

Dim AppointmentLink As New HyperLink
AppointmentLink.NavigateUrl = "appointment.aspx?Time=" & StartTime & "&Provider=" & ProviderCount

AppointmentLink.Text = StartTime.ToShortTimeString

AppointmentLink.NavigateUrl = "AppointmentDetails.aspx?ApptTime=" & StartTime.ToString

AppointmentLink.Target = "AppointmentDetails.aspx?AppTime=" & StartTime.ToString

AppointmentLink.ID = "Provider" & ProviderCount & "_" & StartTime.ToShortDateString & " " & StartTime.ToShortTimeString

AppointmentLink.ID = Replace(AppointmentLink.ID, ":", "_")

AppointmentLink.ID = Replace(AppointmentLink.ID, " ", "_")


Dim ProviderCell As New TableCell
ProviderCell.Controls.Add(AppointmentLink)

TimeRow.Cells.Add(ProviderCell)


Next
tblAppointments.Rows.Add(TimeRow)


Loop
GetAppointments()


End Sub


Next, appointments already booked for the day are queried from a database and returned as a dataview. A routine called GetAppointments() does this. Once the data is retrieved, each appointment record is looped through, looking for a corresponding ID value based on the date and time of the appointment. If one is located, the hyperlink is reformatted with the name of the patients and a different URL to navigate to:


For Each Appointment In Appointments

If Not IsDBNull(Appointment("AppointmentTime")) Then
Literal1.Text = Literal1.Text & Appointment("AppointmentTime") & "<br>"


Dim ApptTime As DateTime = Appointment("AppointmentTime")

'Dim strAppointmentTime As String = ApptTime.ToShortTimeString

Dim strAppointmentTime As String = ApptTime.ToShortDateString & " " & ApptTime.ToShortTimeString
strAppointmentTime = Replace(strAppointmentTime, ":", "_")

strAppointmentTime = Replace(strAppointmentTime, " ", "_")

strAppointmentTime = "Provider1_" & strAppointmentTime


Dim lnkAppointmentLink As HyperLink = FindControl(strAppointmentTime)

If Not (lnkAppointmentLink Is Nothing) Then

If Not IsDBNull(Appointment("LastName")) Then
lnkAppointmentLink.Text = Appointment("LastName")


End If

If Not IsDBNull(Appointment("FirstName")) Then
lnkAppointmentLink.Text = lnkAppointmentLink.Text & ", " & Appointment("FirstName") & "<br>"


End If

If Not IsDBNull(Appointment("AppointmentType")) Then

lnkAppointmentLink.Text = lnkAppointmentLink.Text & Appointment("AppointmentType")


End If

If Not IsDBNull(Appointment("ID")) Then
lnkAppointmentLink.NavigateUrl = "AppointmentDetails.aspx?ID=" & Appointment("ID")

lnkAppointmentLink.Target = "AppointmentDetails.aspx?ID=" & Appointment("ID")


End If
Literal2.Text = Literal2.Text & (Appointment("AppointmentTime")) & "<br>"

Literal3.Text = Literal3.Text & strAppointmentTime & "<br>"



End If


End If

Next


When a calendar date is clicked, it is handled with the following routine:


Private Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged

'Literal1.Text = Calendar1.SelectedDate.ToShortDateString
StartTime = Calendar1.SelectedDate.ToShortDateString & " 8:00:00 am"

tblAppointments.Controls.Clear()

LoadTable(StartTime)


End Sub


As I mentioned, I simply cannot figure out why the appointments from the previous day clicked do not clear since the table is dynamically rebuilt each time a new date is clicked. I have also palced some diagnostic data at the bottom of the page including all of the appointments in the databse and a listing of the days appointements along with the correspodnign controls the GetAppointments() routine should be trying to find. As I said earlier, I am completely stumped on this one. Any help on this would be greatly appreciated. Thanks.



  #2 (permalink)  
Old May 16th, 2006, 10:12 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I looked at the site.. I don't she the problem.. can you explain more clearly?

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fail to signout completely SpringSummer ASP.NET 1.0 and 1.1 Basics 2 April 11th, 2007 11:01 AM
Completely Stumped Admiral1701 Classic ASP Professional 6 December 5th, 2006 02:35 PM
Help!! I am completely stuck... andrewba Classic ASP Components 5 May 12th, 2005 04:50 AM
can't close a winApp completely csc820203 C# 4 July 19th, 2004 03:12 PM
help me in uninstalling MySQL completely ankit_29882 MySQL 3 March 22nd, 2004 05:46 PM



All times are GMT -4. The time now is 01:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.