Hi KatieNgoc,
Refer below sample.
HTML
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
<asp:ListItem Value="1">add1</asp:ListItem>
<asp:ListItem Value="2">add2</asp:ListItem>
<asp:ListItem Value="3">add3</asp:ListItem>
<asp:ListItem Value="4">add4</asp:ListItem>
</asp:CheckBoxList>
<br />
<asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="Redirect">
</asp:DropDownList>
Namespaces
C#
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList1.Items.Clear();
DropDownList1.Items.Insert(0, new ListItem("Select", "0"));
foreach (ListItem li in CheckBoxList1.Items)
{
if (li.Selected)
{
DropDownList1.Items.Add(new ListItem(li.Text, li.Value));
}
}
}
protected void Redirect(object sender, EventArgs e)
{
if (DropDownList1.SelectedValue == "1")
{
Response.Redirect("next.aspx");
}
}
VB.Net
Protected Sub CheckBoxList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
DropDownList1.Items.Clear()
DropDownList1.Items.Insert(0, New ListItem("Select", "0"))
For Each li As ListItem In CheckBoxList1.Items
If li.Selected Then
DropDownList1.Items.Add(New ListItem(li.Text, li.Value))
End If
Next
End Sub
Protected Sub Redirect(ByVal sender As Object, ByVal e As EventArgs)
If DropDownList1.SelectedValue = "1" Then
Response.Redirect("next.aspx")
End If
End Sub
Screenshot