0
還有DropDownList
和CheckBoxList
的形式。
在DropDownList值應取決於選擇改變的CheckBoxList
在DropDownList價值的變化,當您選擇(點擊)元素,
如果取消選中備份不會改變(仍是一樣高)
ASPX:UpdatePanel沒有更新回
Risk:
<asp:UpdatePanel ID="UpRisk" runat="server" UpdateMode="always">
<ContentTemplate>
<asp:DropDownList ID="ddlRiskLevel" runat="server" Enabled="false" AutoPostBack="True">
<asp:ListItem Text="Low" Value="1" Selected="True" />
<asp:ListItem Text="High" Value="2" />
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel24" runat="server" UpdateMode="always">
<ContentTemplate>
Sign:
<asp:CheckBoxList ID="chbList_Risks" runat="server">
<asp:ListItem> Sign1 </asp:ListItem>
<asp:ListItem> Sign2 </asp:ListItem>
<asp:ListItem> Sign3 </asp:ListItem>
</asp:CheckBoxList>
</ContentTemplate>
</asp:UpdatePanel>
Код:
protected void Page_Load(object sender, EventArgs e)
{
foreach (ListItem item in chbList_Risks.Items)
{
if (item.Selected)
ddlRiskLevel.SelectedValue = "2";
}
}