[英]Checkbox do not return the checked value
I have 3 checkboxes. 我有3个复选框。
int e_n_SG = 0;
int e_n_PR = 0;
int e_n_FG = 0;
if (natSG.Checked)
{
e_n_SG = 1;
}
if (natPR.Checked)
{
e_n_PR = 1;
}
if (natFG.Checked)
{
e_n_FG = 1;
}
addScholarship updated1 = new addScholarship(agg, gender, criteria, id1, e_n_SG, e_n_PR, e_n_FG);
update1[0] = updated1;
when i check foreigner , it will return singaporean when i try to retrieve the data. 当我检查外国人时,当我尝试检索数据时,它将返回新加坡元。 and when i check singaporean, it display nothing.
当我检查新加坡时,它什么也不显示。 i tried to debug and i noticed e_n_FG is not being retrieved.
我尝试调试,但发现未检索到e_n_FG。 :
:
my constructor: 我的构造函数:
public addScholarship(int Aggregate, string Gender, string OtherDetails, int Scholarship_id, int e_n_SG, int e_n_PR, int e_n_FG)
{
this.Aggregate = Aggregate;
this.Gender = Gender;
this.OtherDetails = OtherDetails;
this.Scholarship_id = Scholarship_id;
this.e_n_SG = e_n_SG;
this.e_n_PR = e_n_PR;
this.e_n_SG = e_n_FG;
}
anyone could advise me? 有人可以建议我吗?
在控件中使用将AutoPostBack =“ true”与事件一起使用
<asp:CheckBox ID="chkBox" runat="server" AutoPostBack="true" />
public addScholarship(int Aggregate, string Gender, string OtherDetails, int Scholarship_id, int e_n_SG, int e_n_PR, int e_n_FG)
{
this.Aggregate = Aggregate;
this.Gender = Gender;
this.OtherDetails = OtherDetails;
this.Scholarship_id = Scholarship_id;
this.e_n_SG = e_n_SG;
this.e_n_PR = e_n_PR;
this.e_n_SG = e_n_FG; // <--- it should be this.e_n_FG = e_n_FG;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.