Private Sub SetDateWeekDropDownList(ByVal mYearMonth As String)
        Dim i As Integer 
= 0, j As Integer = 0
        Dim StartDate As String 
= Format(CDate(mYearMonth & "-01"), DATE_FORMAT)
        Dim EndDate As String 
= Format(DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(StartDate))), DATE_FORMAT)
        Dim mDay As Integer 
= DateDiff(DateInterval.Day, CDate(StartDate), CDate(EndDate)) + 1
        Dim mWeek As Integer 
= Weekday(CDate(StartDate)) - 1
        Dim tr As TableRow
        Dim tc As TableCell
        Dim IntDay As Integer 
= 1
        Dim IntmDay As Integer 
= 1
        For i 
= 1 To 6
            tr 
= New TableRow
            For j 
= 0 To 6
                If mWeek 
<= j Then
                    If IntDay 
<= mDay Then
                        tc 
= New TableCell
                        tc.HorizontalAlign 
= HorizontalAlign.Center
                        tc.Text 
= IntDay
                        tr.Cells.Add(tc)
                        IntDay 
= IntDay + 1
                    Else
                        tc 
= New TableCell
                        tc.Text 
= ""
                        tr.Cells.Add(tc)
                    End If
                Else
                    tc 
= New TableCell
                    tc.Text 
= ""
                    tr.Cells.Add(tc)
                End If
            Next
            tableDate.Rows.Add(tr)
            tr 
= New TableRow
            For j 
= 0 To 6
                If mWeek 
<= j Then
                    If IntmDay 
<= mDay Then
                        tc 
= New TableCell
                        Dim Drp As New DropDownList
                        Drp.ID 
= "DropDownList" & IntmDay

                        'AddHandler Drp.SelectedIndexChanged, AddressOf DropDownListDate_SelectedIndexChanged

                        SetcboShiftSchedule(Drp)
                        tc.Controls.Add(Drp)
                        tr.Cells.Add(tc)
                        IntmDay 
= IntmDay + 1
                    Else
                        tc 
= New TableCell
                        tc.Text 
= ""
                        tr.Cells.Add(tc)
                    End If
                Else
                    tc 
= New TableCell
                    tc.Text 
= ""
                    tr.Cells.Add(tc)
                End If
            Next
            mWeek 
= 0
            tableDate.Rows.Add(tr)
        Next
    End Sub

    Private Sub SetcboShiftSchedule(ByVal Drp As DropDownList)
        Dim Item As ListItem
        Item 
= New ListItem("---All---"0)
        Drp.Items.Add(Item)

        Item 
= New ListItem("AAAAAA"1)
        Drp.Items.Add(Item)
        Item 
= New ListItem("BBBBB"1)
        Drp.Items.Add(Item)
        Item 
= New ListItem("CCCCC"1)
        Drp.Items.Add(Item)
        Item 
= New ListItem("DDDDD"1)
        Drp.Items.Add(Item)
        Drp.SelectedIndex 
= 0
    End Sub
posted on 2006-05-30 15:19  Liangyy  阅读(211)  评论(0编辑  收藏  举报