The form has DropDownList and CheckBoxList
The value in the DropDownList should change depending on the CheckBoxList selection.
Put both elements in UpdatePanel .
The value in the DropDownList changes when you select (click) an item, and if you uncheck it, it does not change (it remains high)
aspx:
Π ΠΈΡΠΊ: <asp:UpdatePanel ID="UpRisk" runat="server" UpdateMode="always"> <ContentTemplate> <asp:DropDownList ID="ddlRiskLevel" runat="server" Enabled="false" AutoPostBack="True"> <asp:ListItem Text="ΠΠΈΠ·ΠΊΠΈΠΉ" Value="1" Selected="True" /> <asp:ListItem Text="ΠΡΡΠΎΠΊΠΈΠΉ" Value="2" /> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel24" runat="server" UpdateMode="always"> <ContentTemplate> ΠΡΠΈΠ·Π½Π°ΠΊΠΈ: <asp:CheckBoxList ID="chbList_Risks" runat="server"> <asp:ListItem> ΠΏΡΠΈΠ·Π½Π°ΠΊ1 </asp:ListItem> <asp:ListItem> ΠΏΡΠΈΠ·Π½Π°ΠΊ2 </asp:ListItem> <asp:ListItem> ΠΏΡΠΈΠ·Π½Π°ΠΊ3 </asp:ListItem> </asp:CheckBoxList> </ContentTemplate> </asp:UpdatePanel> Code:
protected void Page_Load(object sender, EventArgs e) { foreach (ListItem item in chbList_Risks.Items) { if (item.Selected) ddlRiskLevel.SelectedValue = "2"; } }