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 applocation - https://code.google.com/apis/consoleSwitch on the "Blogger API v3"Get the latest APIs client library for PHPlocation - https://code.google.com/p/google-api-php-client/downloads/listUpload the files to your host location on on localhostExtract 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 set given.
If there is anything …

How to get indexed by Google & Yahoo

I have seen a lot of ads and services online that provide the facility to get higher page ranks on search engines. But when I asked about those services on Google their respond was not much positive because they said it can decrease you page rank (because those services cannot be trusted always). It is happening because the page rank is depending on page visitors (as Google say). So the better way is to let the Google to index your site by sending them the address of your website. http://www.google.com/webmasters/ : here you can improve the traffic with the webmaster tools and you can send your website contents also. It is a legal, simple and direct hit.
You can send your web site address (even the blog) to Yahoo: https://siteexplorer.search.yahoo.com also. It helps them to index your pages on their search engines.


It is better to come up with the content and services which are really useful for the visitors and the traffic will be increased regularly. I have gone through a lot of expe…

How to Install ColdFusion 8 on Linux?

It was real pain for me to install ColdFusion on my Linux box with Apache. Anyway we have installed it and I thought to share it because this may help you also to install ColdFusion on a Linux box.
First of all open a shell and then continue on this.

Grant Execute permission to the Coldfusion‐8‐lin.bin binary file
chmod +x Coldfusion‐8‐lin.bin

Execute Coldfusion‐8‐lin.bin
./Coldfusion‐8‐lin.bin

Enter the Locale
1 (English)

Hit Enter 28 times to continue the agreement

Enter "Y" to accept the agreement

Enter the version to install
3 (Developer Edition)

Enter the next task to perform
1 (Server Configuration)

Enter whether you have an existing server configuration
2 (No existing server configuration)

Enter the next task to perform
5 (continue installation)

Enter the installation path
Hit enter to accept the default path

Hit Enter 30 times to continue the agreement

Enter "Y" to accept the agreement

Enter the serial number
Hit Enter for no serial number

Enter whether you h…