Skip to main content

User Controls vs. Custom Controls

The first thing I have to do in here is to apologise for not posting something on this blog for a long time. Yes it was really a long time without any posting. There were some reasons for that like I had to go abroad (still I am at Canada, and it is a big experience). So I was new in here had lot of work to do. Anyway I hope to post regularly now onwards. 

I have been on 2 projects in here (web applications). On one project it was designed to do by using more “User Controls” and the other one was using “Custom Controls” so first of all I was pretty confused with mixing these two approaches. In my mind I was like in a war to identify what is the better approach and thought to write about those a little.

User Controls 

Basically a User Control is like a normal aspx page only different I can see is the file extension is as ascx. We can make a user control and it has a code behind also. We can just build this as a web page and treat it as a normal web page on aspx. So we can have properties and methods on the code behind and can have all the controls as on aspx and HTML. 

User Controls can be built as a reusable thing for a project and we can insert on several places on a particular project. For example we can build a Form or some contents with styles. Since we can dynamically assign the properties it can used on many places and helps maintains the uniformity. So when an aspx page is built then it will be a collection of user controls and an assignment of properties for them. 

User controls were developed even though it is used only on one place. They were maintained as user controls because we can use them when a change or an enhancement is needed. The other thing is we can just publish the user controls on MOSS. Since the project I was on which had user controls were published on MOSS so we haven`t done any aspx page and all the user controls were either directly published on MOSS or used by another User Control. 

In this URL below you can find more I mean more on how to develop a user control. To understand when and where to use them it is needed to do some hands on experiments.

http://msdn.microsoft.com/en-us/library/bb386451.aspx

Custom Controls 

A custom control is basically a class. It derives from Control or WebControl.  So what we are doing is making some control that is reusable on any project.  What usually made are customized Data grids (like editable grids), Date Time pickups, and textbox with AJAX suggestions. Since these are Classes we can use the dlls on anywhere. (Even on another project easily) 

It can either be inserted on an aspx page directly or on a User Control. What I am thinking is making a lot of complex Custom controls that only can be used on one project is not worthy unless we are reusing it more and more (on same project). And it will be better we can make more generic Custom Controls that enhances the functionality of aspx controls. (It is what happens on most software companies) 

You can find on how to develop a new custom control and insert it on an aspx (or ascx) by visiting the link below. 

http://msdn.microsoft.com/en-us/library/zt27tfhy.aspx

On the other project we were using the custom controls and they were just put on the aspx pages. The custom controls we were built was a bit complex ones (and used once inside the project and specialized for the same project).  So there were about 2-3 custom controls per page.  I think it will be better if we are using both control types on a web application and the custom controls should be compatible with other projects and user controls may be more specified for a particular project.   

I know that I don`t have a lot of experience on these so if there is some more information or something need to be changed please let me know.

Comments

  1. Who knows where to download XRumer 5.0 Palladium?
    Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

    ReplyDelete
  2. Hey keep posting such good and meaningful articles.

    ReplyDelete

Post a Comment

Popular posts from this blog

Google API v3 with PHP using Blogger service

It was really hard for me to understand how the Google APIs are working at the first point and took few days for me to figure out. But after a successful working prototype it seems very easy. And also when I am searching for a simple example I was unable to find a good one that I can understand. So let me list down step by step what I have done with URLs and as simple as I can. Create a Google app location -  https://code.google.com/apis/console Switch on the "Blogger API v3" Get the latest APIs client library for PHP location -  https://code.google.com/p/google-api-php-client/downloads/list Upload the files to your host location on on localhost Extract the files to folder  named "GoogleClientApi" Create your php file outside of the folder  Copy paste following code into the file and do the changes as needed  By changing the scope and the service object you can access all the services that is given by Google APIs through the PHP API library se

My two cents on new year resolution

What is the plan for the new year ? - need to think on what are we trying achieve during next year 2018 - basically the life goals - may be personal or professional - and also it should be realistic (not something like going to Mars ;)) Why we need a plan for the new year ? - basically a goal without a plan is a DREAM - And also should be able to measure (what you cannot measure, you cannot manage) How to prepare a new Year resolution/plan ? - Leave some buffer time - Make changes during the year (life is changing/evolving) - Plan is only for you (do not share it) - When a milestone is achieved, celebrate - Try to stick to the plan - otherwise no point of planing

Assets and Liabilities as Rich Dad, Poor Dad explains

I was reading "The rich dad poor dad by Robert Kiyosaki" here is a one point that he mentions on that. Basically Asset as he says is little bit different than on books. If something puts money in your pocket it is a asset. And Liabilities are the ones that takes money out of your pocket. OK for example a house or a car may seems like an Asset but it takes money out of you pocket to maintain them. But if you rent them or make them to make money at the end of the day you can convert it to a asset. Basically that what rich people do. They buy assets. Middle class buy liabilities (thinking those are assets) and stuff (a lot of them that not used or that not needed). Lower class buy to consume (basic needs like foods).