0
asp.net에서 동적 드롭 다운 목록을 만드는 방법은 무엇입니까?ASP.Net의 동적 드롭 다운 목록
<asp:DropDownList ID="FirstParameter" runat="server">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:DropDownList>
라벨 다른 드롭 다운리스트 :
<asp:Label ID="SecondParameter_Label" runat="server" Text=""></asp:Label>
<asp:DropDownList ID="SecondParameter" runat="server">
</asp:DropDownList>
나는 FirstParameter
드롭 다운리스트에서 선택을 변경 한 다음 텍스트에
SecondParameter_Label
은 선택에 따라 변경해야하므로
SecondParameter
dropdownl의 경우 ist는 첫 번째 드롭 다운 목록에서 선택한 값을 기반으로 데이터 필터로 바인딩되어야합니다.
나는이 코드를 시도했지만 작동하지 않습니다 : 내가 처음 SecondParameter_Label
텍스트를 변경 시도했지만 여전히 작동하지 않습니다
Protected Sub FirstParameter_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles FirstParameter.SelectedIndexChanged
'Change the label text
SecondParameter_Label.Text = ReportType_Dropdownlist.SelectedItem.Value
'Bind value to the SecondParameter dropdownlist
SecondParameter.DataSource = dataTableName '--> Assumed that I already have the DataTable called from a class
SecondParameter.DataTextField = "NameofDatabaseColumn"
SecondParameter.DataValueField = "NameofDatabaseColumn"
SecondParameter.DataBind()
End Sub
. 어떻게해야합니까?
안녕하세요, 고맙습니다. :) –