我有一个收音机按钮
<asp:RadioButton ID="AMRadioButton" runat="server" AutoPostBack="True" GroupName="TypeGroup"
OnCheckedChanged="AMRadioButton_CheckedChanged" Text="Accounting Date" />
<asp:RadioButton ID="LMRadioButton" runat="server" AutoPostBack="True" GroupName="TypeGroup"
OnCheckedChanged="LMRadioButton_CheckedChanged" Text="Loan Date" />
我有一个密码
protected void AddButton_Click(object sender, EventArgs e)
{
if (AMRadioButton.Checked = true)
{
prenda.Bcode = BranchCodetxtbox.Text;
prenda.AccountingMonth = YearDropDownList.SelectedValue + "/" + MonthDropDownList.SelectedValue;
prenda.Jprincipal = Convert.ToDecimal(JewelryTextBox.Text);
prenda.Aprincipal = Convert.ToDecimal(ApplianceTextBox.Text);
prenda.Cprincipal = Convert.ToDecimal(CellphoneTextBox.Text);
user.UserID = Session["UserID"].ToString();
servs.UploadPrendaAM(prenda, user);
Session["Count"] = "1";
Response.Write("<script language='javascript'>window.alert('Success!');window.location='DataEntryPage.aspx';</script>");
}
else if (LMRadioButton.Checked = true)
{
prenda.Bcode = BranchCodetxtbox.Text;
prenda.LoanMonth = YearDropDownList.SelectedValue + "/" + MonthDropDownList.SelectedValue;
prenda.Jprincipal = Convert.ToDecimal(JewelryTextBox.Text);
prenda.Aprincipal = Convert.ToDecimal(ApplianceTextBox.Text);
prenda.Cprincipal = Convert.ToDecimal(CellphoneTextBox.Text);
user.UserID = Session["UserID"].ToString();
servs.UploadPrendaLM(prenda, user);
Session["Count"] = "1";
Response.Write("<script language='javascript'>window.alert('Success!');window.location='DataEntryPage.aspx';</script>");
}
}
问题是,即使我已经检查/选择了LMradio按钮,代码仍然会进入
if(AMRadioButton.Checked = true)
这不是我想要的,当然,当我勾选LMradio按钮时,代码应该是
else if (LMRadioButton.Checked = true)
在这里不在amradiobutton。检查。
我错过什么了吗?请帮忙