1
爲什麼當用戶從下拉菜單中選擇不同的選項時,Line1Co.Value始終保持爲0?受保護的Sub name.ValueChanged不更新
這裏是我的HTML:
<asp:DropDownList ID="HandLine1Size" runat="server" AutoPostBack="true" Width="110px">
<asp:ListItem Value="1">1.75</asp:ListItem>
<asp:ListItem Value="1.5625">2</asp:ListItem>
<asp:ListItem Value="2.25">2.5</asp:ListItem>
<asp:ListItem Value="3.0625">3</asp:ListItem>
<asp:ListItem Value="0">No handline</asp:ListItem>
</asp:DropDownList
<asp:HiddenField ID="Line1Co" runat="server" />
<br />
<%= Line1Co.Value %>
這裏是我的代碼背後:
Protected Sub Line1Co_ValueChanged(sender As Object, e As EventArgs) Handles Line1Co.ValueChanged
If HandLine1Size.SelectedValue = "1" Then Line1Co.Value = "12" Else
If HandLine1Size.SelectedValue = "1.5625" Then Line1Co.Value = "8" Else
If HandLine1Size.SelectedValue = "2.25" Then Line1Co.Value = "2" Else
If HandLine1Size.SelectedValue = "3.0625" Then Line1Co.Value = "0.75" Else
Line1Co.Value = "20"
End Sub