public void setSource(DataObject source) { this.source = source; lblTitle.Text = "Edit " + makeLabel(source.GetType().Name); if (!string.IsNullOrEmpty(source.getName())) lblTitle.Text += ": " + source.getName(); PropertyInfo[] infos = source.GetType().GetProperties(); Properties = new List<PropertyInfo>(infos); for (int i = 0; i < Properties.Count; ++i) { if (Properties[i].Name.Contains("_")) { Properties.RemoveAt(i); --i; } } contents.DataSource = Properties; contents.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { source = new DataUtils.UserAccount(); PropertyInfo[] infos = source.GetType().GetProperties(); Properties = new List<PropertyInfo>(infos); for (int i = 0; i < Properties.Count; ++i) { if (Properties[i].Name.Contains("_")) { Properties.RemoveAt(i); --i; } } contents.DataSource = Properties; contents.DataBind(); } else { contents.DataSource = Properties; contents.DataBind(); } }