Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display days split in half 1

Status
Not open for further replies.

Halliarse

IS-IT--Management
Jan 8, 2007
213
0
0
GB
Hi

I am writing an application that incorporates the standard ASP.Net calendar and I wanted to know if it is possible to display a day split in 2?

i.e. If a statff member is on holiday today but only on a half day this morning, I want to show this morning as the specified colour and this afternoon as my standard defined calendar calendar!

If this is possible can someone please point me in the right direction?

Many thanks

Steve
 
I think I may have come up with the solution....the last set of code I supplied i believe is right!! It's the criteria for building the dataset that is wrong! The data relates to Stylists actual working days, which need to be selectable, so I need to change that to store the records that aren't there, ie If they work Monday, Tuesday and Thursday, my dataset needs to contain the remaining days....watch this space!
 
Good Morning!

Massive progress, however still a slight issue!

I moved away from the dataset and built an array containing 0/1 depending on whether its a workday, non-working days being = 0. This works perfectly on the first display of the calendar. If I move forward to the next month, all off the dates change colour! The code is below and the before and after images attached....let me know what you think?

Dim Day_Loop As Integer = 0

For Day_Loop = 1 To 7
If Days(Day_Loop) = 0 Then
Select Case Day_Loop
Case "1"
If e.Day.Date.DayOfWeek.ToString = "Monday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Case "2"
If e.Day.Date.DayOfWeek.ToString = "Tuesday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Case "3"
If e.Day.Date.DayOfWeek.ToString = "Wednesday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Case "4"
If e.Day.Date.DayOfWeek.ToString = "Thursday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Case "5"
If e.Day.Date.DayOfWeek.ToString = "Friday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Case "6"
If e.Day.Date.DayOfWeek.ToString = "Saturday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Case "7"
If e.Day.Date.DayOfWeek.ToString = "Sunday" Then
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
End Select
End If
Next
 
 http://files.engineering.com/getfile.aspx?folder=4759bb98-02e3-498a-a4f1-6be1c9db3447&file=First_Render.docx
What event are you building your array? Remember, the calendar causes a postback on change of month or day selection. did you wrap the build of the array in a
Code:
if not page.ispostback thn
'build array
end if
 
The array is only built the one time, on a selectedindexchanged on a dropdownlist
 
You will have to debug. do you still have access to the array after postback? etc
 
We finally got there!! I always forget about postback....my first web pages project!! I recoded it so that it stored as a session variable!!

Many thanks for your extensive assistance (Speak again, I'm sure!)
 
Glad to help.
Remember that on a post back in most cases you don't want/need to access the db and rebuild data. Just wrap you code in:
Code:
If NOT page.IsPostback
Me.GetData
End if
Code:
i usually do this in the page_load or page_init and put my data access code in a separate function or sub
private sub GetData()
get data...
bind to control...
end sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top