Friday, June 26, 2009

What is the difference between a custom control and a user control ?







































Sno

User Control

Custom Control



Is a file with the .ascx extension

Is a file with the .dll extension

2

Can be
only used with the application

Can be
used in any number of applications

3

Language
dependent.

They are
language independent, a control
created in c# can be used in vb.net

4

Can’t be
added to Visual studio Toolbox

Can be added to Visual studio Toolbox

5

Inherits
from Server controls and easy to create.

You have
to develop from scratch ,
so comparatively
difficult.

6

Generally
used for static content

Used when
dynamic content is required

What are the differences between Trace and Debug?



















Sno

Trace

Debug



Works in both Debug and Release mode

Works
only in Debug mode.

2

Trace is enabled by default in visual studio

Debug is not enabled. You can manually do that.




How to call a user controls method from its parent?

For example the name of your control be a SecureLoginControl and the solution be MyControls and the method you are going to call is SecuredAuthentication(), then the coding you need to do is ,

Control declaration:
Public MyControls.SecureLoginControl objSecureLoginControl ;

When calling:
boolean b;
b=objSecureLoginControl.SecuredAuthentication();

or you can call like this also,

((SecureLoginControl)Panel1.FindControl("objSecureLoginControl")).SecuredAuthentication();

What are asynchronous callbacks in .net?

It means that a call is made from a Main Program to a .net Class’s method and the program continues execution. When the callback is made ( means the method has finished its work and returns value) , the Main program handles it.

What are the differences between machine.config and web.config files?





























Sno

Web.config

Machine.config



It is a config file for a single application.

It is a config file which is common for all the applications in a machine

2

It will be available in the application folder.

It is available in the Microsoft.NET\Framework\{version}\CONFIG Folder.

3

The settings in the web.config overrides that of Machine.config

Cant do.

4

Automatically installed when visual studio .net is installed

This is automatically created when you create an asp.ne website




What is web.config.? How many web.config files can be allowed to use in an application?


1.    
 

The Web.Config file is the configuration file for
asp.net web application or a web site. prefix="o" ?>



2.    
 

You can have as many Web.Config files as you want
, but there can be only one web.config file in a single folder.

What are the differences between value and reference types

























Sno


Value Types



Reference Types



They contain their data directly

They store a reference to their value’s memory

2

They are allocated for storage either in stack or inline in structure..

They are allocated for storage in heap

3

can be built-in (implemented by the runtime), user-defined, or enumerations

self-describing types, pointer types, or interface types.


How do you relate an aspx page with its code behind page ?



Using the Page Directive.


<@page .. codefile="yourcsfile.aspx.cs" ...

where does a sharepoint webpart inherit from?

To create a SharePoint Web Part, you should inherit from the


Microsoft.SharePoint.WebPartPages.WebPart


base class.


For creating a basic sharepoint webpart see this link,




http://msdn.microsoft.com/en-us/library/ms452873(loband).aspx

what is autoeventwireup?

It is an automatic way to associate Asp.net Page events and methods.


When the autoeventwireup page attribute is set to true page events are automatically called.


The disadvantage is that it expects page events in a predictable way , so you loose the flexibility of choosing your own event handler names.