1

動的ドロップダウンリストを作成しました。ドロップダウンリストの数は、選択した月の合計日数と同じです。

すべてのドロップダウンを配置しましasp:tableたが、データフォームのドロップダウンリストを取得できず、selectedindexchangeイベントを発生させることができません。

私のコードを以下に示します

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Table2.Rows(0).Cells(0).Text = v1_drop_month.SelectedItem.Text
        helper.return_month(v1_drop_month.SelectedItem.Text)

        i = 1
        For row = 0 To 6
            For cell = 1 To 7

                Dim dd As New DropDownList


                Dim label As New Label
                If row = 0 And cell = 1 Then
                    Table2.Rows(row).Cells(cell - 1).BackColor = Drawing.Color.Teal
                ElseIf row = 1 Then
                    Table2.Rows(1).Cells(cell - 1).Font.Size = 14
                    Table2.Rows(1).Cells(cell - 1).HorizontalAlign = HorizontalAlign.Center
                    Table2.Rows(1).Cells(cell - 1).ForeColor = Drawing.Color.White
                    Table2.Rows(1).Cells(cell - 1).BackColor = Drawing.Color.Black

                ElseIf row >= 2 Then
                    If i <= helper.month_num Then

                        dates = helper.Month_no & "-" & i & "-" & v1_drop_month.SelectedItem.Text.Substring(4, 4)
                        day = New DateTime(v1_drop_month.SelectedItem.Text.Substring(4, 4), helper.Month_no, i)

                        If Table2.Rows(1).Cells(cell - 1).Text = day.DayOfWeek.ToString() Then
                            label.Text = i
                            label.Font.Size = 20
                            label.ForeColor = Drawing.Color.Red
                            Table2.Rows(row).Cells(cell - 1).HorizontalAlign = HorizontalAlign.Right
                            label.ID = row & "-" & cell

                            Table2.Rows(row).Cells(cell - 1).Controls.Add(label)
                            If day.DayOfWeek.ToString() <> "Sunday" Then
                                label.ForeColor = Drawing.Color.Blue

                                Table2.Rows(row).Cells(cell - 1).Controls.Add(dd)
                                dd.ID = "dd" & row & "-" & cell

                                sql = String.Empty
                                sql = "select distinct route_number from fr_route where territory='" & v1_drop_territory.SelectedItem.Text & "' and state='" & v1_drop_state.SelectedItem.Text & "' and hq='" & v1_drop_hq.SelectedItem.Text & "'"
                                helper.dropdown_change(sql, "route_number", dd)

                                Table2.Rows(row).Cells(cell - 1).BackColor = Drawing.Color.SkyBlue
                                dd.BackColor = Drawing.Color.Khaki
                                Table2.Rows(row).Cells(cell - 1).Height = 50


                            End If

                            i = i + 1
                        End If
                    Else

                    End If
                End If
            Next
        Next
        v1_but_save.Visible = True
        v1_but_reset.Visible = True
        v1_but_send.Visible = True

    End Sub

asp:tableショーのドロップダウンメニューに使用しました

4

1 に答える 1

0

ドロップダウンリストの「AutoPostBack=True」を有効にする

于 2013-01-08T12:01:31.010 に答える