0

我怎样才能使内容模板中的控制事件起作用?我无法直接访问控件,这很烦人,但现在这些事件甚至不会因为某种原因而触发?我开始讨厌网络编程...

正面:

<act:TabContainer ID="tcTabellen" runat="server" TabIndex="0" AutoPostBack="true">
        <act:TabPanel ID="tpBeitragssaetze" HeaderText="Beitragss&auml;tze" runat="server">
            <ContentTemplate>
                <p>
                    <asp:Label ID="lbKasse" runat="server">Kasse</asp:Label> 
                    <asp:DropDownList runat="server" ID="ddlKasse" AutoPostBack="true"></asp:DropDownList>
                    <asp:Label ID="lbJahr" runat="server">Jahr</asp:Label>
                    <asp:DropDownList runat="server" ID="ddlJahr" AutoPostBack="true"></asp:DropDownList>
                </p>
            </ContentTemplate>
        </act:TabPanel>
</act:TabContainer> 

在后面:

WithEvents ddlKasse As DropDownList
WithEvents ddlJahr As DropDownList

Private Sub ddlKasse_DataBind()
        ddlKasse = CType(Me.tcTabellen.FindControl("tpBeitragssaetze").FindControl("ddlKasse"), DropDownList)
        ddlKasse.AutoPostBack = True

        ddlKasse.Items.Clear()

        ddlKasse.Items.Insert(0, New ListItem With {.Text = "Bitte auswählen ...", .Value = "0"})
        ddlKasse.Items.Insert(1, New ListItem With {.Text = "01 - BKK Höchst (W)", .Value = "01"})
        ddlKasse.Items.Insert(2, New ListItem With {.Text = "02 - BKK Höchst (O)", .Value = "02"})
        ddlKasse.Items.Insert(3, New ListItem With {.Text = "10 - BKK Gesundheit (Alt) (W)", .Value = "10"})
        ddlKasse.Items.Insert(4, New ListItem With {.Text = "13 - Sancura BKK (W)", .Value = "13"})
        ddlKasse.Items.Insert(5, New ListItem With {.Text = "21 - DKV (W)", .Value = "21"})
        ddlKasse.Items.Insert(6, New ListItem With {.Text = "22 - DKV (O)", .Value = "22"})
        ddlKasse.Items.Insert(7, New ListItem With {.Text = "32 - BKK Vita-Dyckerhoff (W)", .Value = "32"})
        ddlKasse.Items.Insert(8, New ListItem With {.Text = "34 - BKK Gesundheit (W)", .Value = "34"})
        ddlKasse.Items.Insert(9, New ListItem With {.Text = "35 - BKK Gesundheit (O)", .Value = "35"})
        ddlKasse.Items.Insert(10, New ListItem With {.Text = "56 - STJB (W)", .Value = "56"})
        ddlKasse.Items.Insert(11, New ListItem With {.Text = "69 - BKK Bodensee + Südwest (W)", .Value = "69"})
        ddlKasse.Items.Insert(12, New ListItem With {.Text = "71 - STJB (O)", .Value = "71"})
        ddlKasse.Items.Insert(13, New ListItem With {.Text = "82 - BKK Vita Dyckerhoff (O)", .Value = "82"})
        ddlKasse.Items.Insert(14, New ListItem With {.Text = "83 - BKK Gesundheit (Alt) (O)", .Value = "83"})
        ddlKasse.Items.Insert(15, New ListItem With {.Text = "84 - Sankura BKK (O)", .Value = "84"})
        ddlKasse.Items.Insert(16, New ListItem With {.Text = "93 - BKK FPB Holding (W)", .Value = "93"})
    End Sub

Private Sub ddlKasse_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlKasse.SelectedIndexChanged
        ddlJahr_DataBind()
End Sub

如果另一个 ddl 的 selectedindex 发生更改,我只想填充一个 ddl,但正如我之前提到的 .. 事件不会触发。有没有人知道它是什么样的以及我该如何解决它?

提前致谢!

4

1 回答 1

1

您的 ddl 需要其标签上的 onselectedindexchanged :

<asp:DropDownList runat="server" ID="ddlKasse" onselectedindexchanged="ddlKasse_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
于 2013-02-20T12:53:22.763 回答