protected void Page_Load(object sender, EventArgs e) { List <ProfileAttribute> listAttribute = new List <ProfileAttribute>(); listAttribute = _Repository.GetProfileAttributesByProfileID(_profile.ProfileID); System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br"); this.Controls.Add(br); foreach (ProfileAttribute proAttribute in listAttribute) { System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br"); Label lbl = new Label(); lbl.Width = 150; lbl.Height = 18; lbl.ForeColor = System.Drawing.Color.Blue; lbl.ID = "lbl" + proAttribute.ProfileAttributeID.ToString(); lbl.Text = proAttribute.ProfileAttributeName; TextBox txt = new TextBox(); txt.Width = 150; txt.Height = 18; lbl.ForeColor = System.Drawing.Color.CornflowerBlue; txt.ID = "txt" + proAttribute.ProfileAttributeID.ToString(); txt.Text = proAttribute.Response; this.Controls.Add(lbl); this.Controls.Add(txt); this.Controls.Add(brTab); } }
// lay ra list thuoc tinh cua ProfileID do public List <ProfileAttribute> GetProfileAttributesByProfileID(Int32 ProfileID) { List <ProfileAttribute> attributes = _profileAttributeRepository.GetProfileAttributesByProfileID(ProfileID); //lay kieu thuoc tinh cua tung thuoc tinh foreach (ProfileAttribute attribute in attributes) { attribute.ProfileAttributeType = _profileAttributeRepository.GetProfileAttributeTypeByID(attribute.ProfileAttributeTypeID); } return(attributes); }