Wednesday, 21 August 2013

Best way to do the runtime UI changes on User Control?

Best way to do the runtime UI changes on User Control?

I am new to the .net and I am working on the some functionality in office
that is as below
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
}
This is how i did the required UI changes in databound event of form view,
but one of senior says 'It's bad architectural code design it has extra
memory issue and make the UI changes in the _usrcontrolproperty set method
after the data bind.'. So i want to know
1) Is this really bad architectural code ? If bad then why ?
2) And if my seniors way is bad then also Why ?
Because i thought the UI changes should done at the the time of the
binding the data

No comments:

Post a Comment