我在实验室项目中完成了一个阶段。我最好用照片随意地描述我的问题。我目前已阅读controls visibility in C#主题,但我需要提出更多问题。我需要知道如何仅使用C#来实现这种困境。
使用的代码:
protected void ddlStudents_SelectedIndexChanged(object sender, EventArgs e)
{
lblEmail.Visible = true;
lblName.Visible = true;
lblReg.Visible = true;
lblUserActive.Visible = true;
lblTelephone.Visible = true;
lblFamilyName.Visible = true;
lblBirth.Visible = true;
CatalogAccess ca=new CatalogAccess();
UserDetails ud = ca.GetUser(23);
//HiddenID.Value = String.Format(ud.UserID);
lblName.Text = ud.UserName;
lblEmail.Text = ud.UserEmail;
lblFamilyName.Text = ud.UserFamilyName;
lblBirth.Text=String.Format("{0:dd/MM/yyy}",ud.UserBirthDay);
lblTelephone.Text = ud.UserTelephone;
lblReg.Text =String.Format("{0:dd/MM/yyy HH:MM}",ud.RegDate);
if (ud.UserActive == true)
{
chbActive.Checked = true;
lblUserActive.Text = "Yes";
}
else
{
chbActive.Checked = false;
lblUserActive.Text = "No";
}
//ud.UserActive != 0 ? chbActive.Checked = false : chbActive.Checked = true;
//lblUserActive.Text = ud.UserActive != 0 ? "Activated" : "Not Activated";
//ddlStudents.Items.Clear();
//PopulateStudentsDDL();
}
更新
protected void btnUpdate_Click(object sender,EventArgs e) { lblBirth.Visible = true; lblReg.Visible = true; ddlPrefix.Visible = true; btnUpdateUnderPanel.Visible = true;
lblName.Visible = false;
tbName.Visible = true;
tbName.Text = lblName.Text;
lblFamilyName.Visible = false;
tbFamilyName.Visible = true;
tbFamilyName.Text = lblFamilyName.Text;
lblTelephone.Visible = false;
tbTelephone.Visible = true;
tbTelephone.Text = lblTelephone.Text;
lblEmail.Visible = false;
tbEmail.Visible = true;
tbEmail.Text = lblEmail.Text;
lblUserActive.Visible = false;
chbActive.Visible = true;
}
问题是:
如何以更专业的方式实施?
请告诉我,不要告诉我关于小组的事。这里不需要面板。我只改变了几个控件。