【发布时间】:2013-08-24 16:53:09
【问题描述】:
我是 .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 更改应该在绑定数据时完成
【问题讨论】:
-
他能解释一下“额外的内存问题”吗?
-
@Simon 我试图和他讲道理,但他没有告诉我。这就是我在这里问的原因。
-
@Curiosity 他/她似乎有他/她自己的记忆问题,对于编码部分的设计,Simon 给出的方式比你做的要好得多现在
标签: c# asp.net architecture user-controls