One important thing in all development is to keep code redundance at a minimum. Object orientated programming helps us alot in this area.
We have at least two possibilities to acomplish this for the C# code for our Enterprise Portal .NET user controls.
Method one
Create a user control to hold all common code and then use that control when ever we need to access the common code. This requiers us to reference the control were ever we need the code, not very neat but it works.
Method two
I prefer this one personally, create a control that inherits the AxBaseUserControl and place all your code in here. When ever you create a user control, change the inheritance so that the newly created control inherits you base control. By doing this we have access to all the common code that we need with simple inheritence.
We have at least two possibilities to acomplish this for the C# code for our Enterprise Portal .NET user controls.
Method one
Create a user control to hold all common code and then use that control when ever we need to access the common code. This requiers us to reference the control were ever we need the code, not very neat but it works.
Method two
I prefer this one personally, create a control that inherits the AxBaseUserControl and place all your code in here. When ever you create a user control, change the inheritance so that the newly created control inherits you base control. By doing this we have access to all the common code that we need with simple inheritence.
Comments
Post a Comment