[英]Checkbox do not return the checked value
我有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;
當我檢查外國人時,當我嘗試檢索數據時,它將返回新加坡元。 當我檢查新加坡時,它什么也不顯示。 我嘗試調試,但發現未檢索到e_n_FG。 :
我的構造函數:
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;
}
有人可以建議我嗎?
在控件中使用將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.