我是 .net 的新手,我正在开发办公室中的一些功能,如下所示
Jobs.aspx.cs
protected void gvActionItems_RowEditing(object sender, GridViewEditEventArgs e)
{
//setting the value of the user control property
}
JobUserControl.ascx.cs
public int _usrcontrolproperty
{
get{return _usrcontrolproperty;}
set{
//depending on the value of the property fetch the data from the database and binding those data on the user controls FormView
}
}
protected void fvJob_DataBound(object sender, EventArgs e)
{
//Making the dynamic UI changes that is setting properties of controls depending upon the values of binding data
}
这就是我在表单视图的数据绑定事件中进行所需 UI 更改的方式,但一位资深人士说“这是糟糕的架构代码设计,它有额外的内存问题,并在数据绑定后在 _usrcontrolproperty 设置方法中进行 UI 更改。” . 所以我想知道
1) Is this really bad architectural code ? If bad then why ?
2) And if my seniors way is bad then also Why ?
因为我认为 UI 更改应该在绑定数据时完成