Checkbox
当我在 a 中写任何东西时,我想改变我的状态,textbox
所以我做到了
<asp:CheckBox ID="chkIceChest" Text="Ice Chest" runat="server" />
<asp:TextBox ID="txtIceChest" Text="$ cost" runat="server" CssClass="moch-cost" AutoPostBack="true" OnTextChanged="CalculateStand" />
和
protected void CalculateStand(object s, EventArgs e)
{
double total = 0, cost = 0;
if (txtIceChest.Text.Length > 0 && txtIceChest.Text != "$ cost")
{
cost = Convert.ToDouble(txtIceChest.Text.Replace("$", ""));
total += cost;
if (cost > 0) chkIceChest.Checked = true;
}
}
但它不工作!!!!为什么 ?