Pages

Monday, November 14, 2011

Telerik Multiple RadGrid

Here below code is telerik multiple radgrid. You can't copy paste this code but need to change the code as your requirment.



<telerik:RadGrid ID="gridRoles" runat="server" Skin="WebBlue" AutoGenerateColumns="False"
                    PageSize="5" AllowSorting="True" AllowPaging="True" GridLines="None" AllowAutomaticDeletes="True"
                    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnDetailTableDataBind="gridRoles_DetailTableDataBind"
                    OnPageIndexChanged="gridRoles_PageIndexChanged" 
                    OnItemCommand="gridRoles_ItemCommand" onitemdatabound="gridRoles_ItemDataBound">
                    <HeaderContextMenu EnableImageSprites="True">
                    </HeaderContextMenu>
                    <PagerStyle Mode="NumericPages"></PagerStyle>
                    <MasterTableView Width="100%" HierarchyDefaultExpanded="false" DataKeyNames="Roleid">
                        <DetailTables>
                            <telerik:GridTableView Width="40%" runat="server" Name="Modules" HorizontalAlign="Center">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="Roleid" MasterKeyField="Roleid" />
                                </ParentTableRelation>
                                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="Roleid" UniqueName="Roleid" Visible="false">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="ModuleName" HeaderText="Module Names" DataField="ModuleName"
                                        UniqueName="ModuleName">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                        <ExpandCollapseColumn Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" UniqueName="EditCommandColumn">
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="Roleid" UniqueName="Roleid" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Rolename" HeaderText="Role name" DataField="Rolename"
                                UniqueName="Rolename">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" DataField="Status"
                                UniqueName="Status">
                            </telerik:GridBoundColumn>
                            <telerik:GridButtonColumn ConfirmText="Delete this Role?" ConfirmTitle="Delete" ButtonType="ImageButton"
                                CommandName="Delete" UniqueName="DeleteColumn" ConfirmDialogType="RadWindow"
                                ConfirmDialogHeight="100" ConfirmDialogWidth="300">
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridButtonColumn>
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="Rolename" />
                        </SortExpressions>
                        <EditFormSettings>
                            <EditColumn UniqueName="EditCommandColumn1">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                </telerik:RadGrid>

Query for add two nvarchar time columns

Query this in sql query editor:
select from,convert(nvarchar(10),(convert(datetime,Colname1)+convert(datetime,Colname2)),108) as to from  table


Result will be:

Encrypt Appsettings in web.Config


Add these below two lines in pageload event:
ProtectSection("appSettings","DataProtectionConfigurationProvider");
UnProtectSection("appSettings");


Add these methods

private void ProtectSection(string p, string p_2)
    {
        Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);


        ConfigurationSection section = config.GetSection(p);


        if (section != null && !section.SectionInformation.IsProtected)
        {
            section.SectionInformation.ProtectSection(p_2);
            config.Save();
        }
    }


    private void UnProtectSection(string sectionName)
    {
        Configuration config =
            WebConfigurationManager.
                OpenWebConfiguration(Request.ApplicationPath);


        ConfigurationSection section =
                  config.GetSection(sectionName);


        if (section != null &&
              section.SectionInformation.IsProtected)
        {
            section.SectionInformation.UnprotectSection();
            config.Save();
        }
    }


After executing this just go to web.config file and check the app settings tag.

Monday, July 4, 2011

.NET and C# interview questions:Show how do we view an assembly in .NET?


When coming to understand the internals, nothing can beat ILDASM. ILDASM converts the whole ‘exe’ or ‘dll’ in to IL code. To run ILDASM you have to go to ‘C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin’. Note that we had v1.1 you have to probably change it depending on the type of framework version you have.
If you run IDASM.EXE from the path you will be popped with the IDASM exe
program as shown in figure. Click on file and browse to the respective
directory for the DLL whose assembly you want to view. After you select the
DLL you will be popped with a tree view details of the DLL as shown in
figure ILDASM. On double clicking on manifest, you will be able to view
details of assembly, internal IL code etc as shown in the figure.

Note: - The version number are in the manifest itself which is defined with
the DLL or EXE thus making deployment much easier as compared to COM where
the information was stored in registry. Note the version information in Figure
Manifest view.
You can expand the tree for detail information regarding the DLL like methods, properties, functions etc.


And once you open the Manifest you will be able to see the inner details as shown in the following picture: -


Following is the video which shows that how the questions are asked C#
and .NET interviews.

C# and .NET interview questions: Explain in brief an interface?

Interface is a contract that defines the signature of the functionality. So if a class is implementing a interface it says to the outer world, that it provides specific behavior. Example if a class is implementing ‘Idisposable’ interface that means it has a functionality to release unmanaged resources. Now external objects using this class know that it has contract by which it can dispose unused unmanaged objects.
  • Single Class can implement multiple interfaces.
  • If a class implements a interface then it has to provide
    implementation to all its methods.

Following code shows that one has the interface definition and other
class implements the interface. Below is the source code “IInterface” is the
interface and “ClsDosomething” implements the “IInterface”. This sample just
displays a simple message box.

Public Interface IInterFace
Sub Do Something ()
End Interface

Public Class ClsDoSomething
Implements IInterFace
Public Sub DoSomething () Implements WindowsInterFace.IInterFace.DoSomething
MsgBox (“Interface implemented”)
End Sub
End Class

After implementing the above code you will get the following output as shown:


Following you can see a simple video on boxing and unboxing:


.NET and ASP.NET interview questions: Define MVC, MVP and MVVM pattern?

MVC, MVP and MVVM are design patterns which come under the presentation pattern category and they help to remove any kind of cluttered code in UI like manipulation of user interfaces and maintaining state. Thus keeping your UI code cleaner and better to maintain.
MVC(Model view controller) pattern divides the architecture into 3 parts model, view and controller. The first request comes to the controller and the controller then decides which view to be displayed and ties up the model with the view accordingly.

MVP (Model view presenter) has the same goals as MVC i.e. separating the UI from the model. It does the same by using a presenter class. The UI talks via an interface to the presenter class and the presenter class talks with the model.

MVVM is an architectural pattern with the focus of removing UI cluttered code. It does the same by using an extra class called as view model. MVVM is mostly suitable for Silverlight and WPF projects because of the rich bindings provided by the technologies.


Wednesday, June 29, 2011

Silverlight Data Grid - Binding Data using WCF and LINQ to SQL Classes

WCF interview questions - What are 3 ways of implementing WCF(Windows Communication Foundation) concurrency?


Three ways by which you can handle concurrency in WCF is Single, multiple and reentrant. To specify WCF concurrency we need to use the ‘ServiceBehavior’ tag as shown below with appropriate ‘ConCurrencyMode’ property value.


Figure:
Single: - A single request has access to the WCF service object at a given moment of time. So only one request will be processed at any given moment of time. The other requests have to wait until the request processed by the WCF service is not completed.

Multiple: - In this scenario multiple requests can be handled by the WCF service object at any given moment of time. In other words request are processed at the same time by spawning multiple threads on the WCFserver object. So you have great a throughput here but you need to ensure concurrency issues related to WCF server objects.

Reentrant: - A single request thread has access to the WCF service object, but the thread can exit the WCF service to call another WCF service or can also call WCF client through callback and reenter without deadlock.

You can also view video on WCF one way contract as follows: -



Can we see simple animation in SilverLight?

SilverLight interview questions - Three ways applying layouts in SilverLight?

There are three ways provided by Silverlight for layout management is Canvas, Grid and Stack panel. Each of these methodologies fit into different situations as per layout needs.

Canvas – Absolute Positioning

Canvas is the simplest methodology for layout management. It supports absolute positioning using ‘X’ and ‘Y’ coordinates. ‘Canvas.Left’ helps to specify the X co-ordinate while ‘Canvas.Top’ helps to provide the ‘Y’ coordinates.
Below is a simple code snippet which shows how a rectangle object is positioned using ‘Canvas’ on co-ordinates (50,150).




Below is how the display looks like. When you the run the code, the XAML viewer will position the rectangle object on absolute ‘X” and ‘Y’ coordinates.





Grid – Table layout

Grid layout helps you position your controls using rows and columns. It’s very similar to table defined in HTML.



Above is a simple table with two columns and two rows defined using Grid. We have shown how the table display looks like. Using the Grid.ColumnDefinition, we have defined two columns and using Grid.RowDefinition, we have defined two rows. We have then created 4 text blocks which are then specified in each section using Grid.Column and Grid.Row. For instance, to place in the first column, we need specify the Grid.Column as 0 and Grid.Row as 0. We have followed the same pattern for everyone and you can see that all the textblocks are placed in the
appropriate sections.


Stack – One Above the Other

As the name says, so the behavior. Stack allows you to arrange your UI elements vertically or horizontally.



For instance, above are 4 elements which are arranged in a stack panel element. You can see how the stack aligns / stacks the elements one above other. You can also stack the UI elements horizontally or vertically depending on the nature of your layout.
Following is the video which demonstrates simple animation in SilverLight:

Thursday, June 2, 2011

Can you describe Sql Server Views are updatable?

View is a virtual table, which can contains data (rows with columns) from one or more table and you can retrieve data from a view.

Let’s demonstrate a simple example in which we will see that how to create a view on single table and will also see that if we update the view the respective table on which the view is created is updated or not.


Now let first see how to create view.

Go to View folder in SQL Server > Right click on it > select New View.





As soon as you click on New View, the following window will appear like below.



Now, just select the table name from the list on which you wish to create a View and Click on Add then click on close. Once you click on close a new window will appear which allow you to create View on the respective column.



After selecting the column name just save the view and give View a nice name.


Once you have completed the above step you will see that the respective View is added in the View folder.



Now let’s see that when we update the view the respective table is also updated or not.

Query:-


Update [Practice].[dbo].[Cust_View] set Customer_Contact = 96641122 where
Customer_Name = 'Feroz'
Now just go to the table on which the view was created and check whether the table is updated or not, you will see that the table is also updated when you update the View.
Now let’s create a view based on two tables and try to update a view.

create view View_Cust as SELECT    dbo.Customer.Customer_Name, dbo.Customer.
Customer_Contact,dbo.[Order].Product_Name,dbo.[Order].Price
FROM dbo.Customer
INNER JOIN dbo.[Order] ON dbo.Customer.Order_ID = dbo.[Order].Order_ID

Let’s try to Update View:


Query:-
Update [Practice].[dbo].[View_Cust] set Customer_Contact = 098767554,
Price = 4000 where Customer_Name = 'Feroz'

As you can see in the above query, I am trying to update a column from the Product table and another column from the Order table and try to execute the query the compiler will throw the below error.

Error Message:- View or function 'Practice.dbo.View_Cust' is not updatable because the modification affects multiple base tables.

This means that when you try to update both the table’s column from the view then it is not allowed but you can update single table column.

Please click here to see more .NET and SQL Server interview questions

Demo of Button and LinkButton control in ASP.NET

Wednesday, May 25, 2011

WCF Throttling

WCF throttling provides some properties that you can use to limit how many instances or sessions are created at the application level. Performance of the WCF service can be improved by creating proper instance.
Attribute Description
maxConcurrentCalls Limits the total number of calls that can currently be in progress across all service instances. The default is 16.
maxConcurrentInstances The number of InstanceContext objects that execute at one time across a ServiceHost. The default is Int32.MaxValue.
maxConcurrentSessions A positive integer that limits the number of sessions a ServiceHost object can accept. The default is 10.
Service Throttling can be configured either Adminstractive or Programatically

Administrative(configuration file)

Using <serviceThrottling> tag of the Service Behavior, you can configure the maxConcurrentCalls, maxConcurrentInstances , maxConcurrentSessions property as shown below.
<system.serviceModel>
    <services >
      <service behaviorConfiguration="ServiceBehavior"  name="MyService">
        <endpoint address="" binding="wsHttpBinding" contract="IMyService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true "/>
          <serviceThrottling maxConcurrentCalls="500"
 maxConcurrentInstances ="100" 
maxConcurrentSessions ="200"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

Programming Model

Use ServiceThrottlingBehavior object to set concurrent calls, session and instance property.
ServiceHost host = new ServiceHost(typeof(MyService));
           ServiceThrottlingBehavior throttle
 = host.Description.Behaviors.Find();
            if (throttle == null)
            {
                throttle = new ServiceThrottlingBehavior();
                throttle.MaxConcurrentCalls = 500;
                throttle.MaxConcurrentSessions = 200;
                throttle.MaxConcurrentInstances = 100;
                host.Description.Behaviors.Add(throttle);
            }

            host.Open();
   

Metadata Exchange Endpoint

Exposing the metadata using HTTP-GET has a disadvantage, such that there is no guarantee that other platforms you interact will support it. There is other way of exposing the using special endpoint is called as Metadata Exchange Endpoint. You can have as many metadata exchange endpoints as you want.

Address

It is basically Uri to identify the metadata. You can specify as address in the endpoint but append with "mex" keyword. For example "http://localhost:9090/MyCalulatorService/mex"

Binding

There are four types of bindings supported for metadata exchange. They are mexHttpBinding, mexHttpsBinding, mexNamedPipesBinding, mexTcpBinding.

Contract

IMetadataExchange is the contract used for MEX endpoint. WCF service host automatically provides the implementation for this IMetadataExcahnge while hosting the service.
You can create the Metadata Exchange Endpoint either Administrative (configuration file) or programmatically.

Administrative (Configuration file):

In the configuration file of the hosting application, you can add metadata exchange endpoint as shown below.
<system.serviceModel>
<services>
 <service name="MyService">
 <endpoint address="http://localhost/IISHostedService/MyService.svc"
 binding="wsHttpBinding" contract="IMyService">
 <identity>
 <dns value="localhost"/>
 </identity>
 </endpoint>
 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
 </service>
</services>  
</system.serviceModel>

Programming Model:

In the following code I have mention about creating the Metadata Exchange Endpoint through coding. Steps to create the metadata endpoint are
  • Create the ServiceMetadataBehavior object and add to Service host description.
  • ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                host.Description.Behaviors.Add(smb);
  • Create the metadata binding object using MetadataExchangeBinding
  • Binding mexBinding = MetadataExchangeBindings.CreateMexHttpBinding ();
  • 3. Add the endpoint to the service host with address, binding and contract.
  • host.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, "mex");
Complete code for hosting the service with metadata exchange endpoint is shown below.
//Create a URI to serve as the base address
            Uri httpUrl = new Uri("http://localhost:8090/MyService/SimpleCalculator");
            //Create ServiceHost
            ServiceHost host = new 
            ServiceHost(typeof(MyCalculatorService.SimpleCalculator), httpUrl);
            //Add a service endpoint
            host.AddServiceEndpoint
            (typeof(MyCalculatorService.ISimpleCalculator), new WSHttpBinding(), "");
            //Enable metadata exchange
            ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
            host.Description.Behaviors.Add(smb);
            Binding mexBinding = MetadataExchangeBindings.CreateMexHttpBinding ();
            //Adding metadata exchange endpoint
            host.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, "mex");
            //Start the Service
            host.Open();

            Console.WriteLine("Service is host at " + DateTime.Now.ToString());
            Console.WriteLine("Host is running... Press  key to stop");
            Console.ReadLine();

WCF Architecture

The following figure illustrates the major components of WCF.

















Contracts

Contracts layer are next to that of Application layer. Developer will directly use this contract to develop the service. We are also going to do the same now. Let us see briefly what these contracts will do for us and we will also know that WCF is working on message system.

Service contracts

- Describe about the operation that service can provide. Example, Service provided to know the temperature of the city based on the zip code, this service we call as Service contract. It will be created using Service and Operational Contract attribute.

Data contract

- It describes the custom data type which is exposed to the client. This defines the data types, are passed to and from service. Data types like int, string are identified by the client because it is already mention in XML schema definition language document, but custom created class or datatype cannot be identified by the client e.g. Employee data type. By using DataContract we can make client aware that we are using Employee data type for returning or passing parameter to the method.

Message Contract

- Default SOAP message format is provided by the WCF runtime for communication between Client and service. If it is not meeting your requirements then we can create our own message format. This can be achieved by using Message Contract attribute.

Policies and Binding

- Specify conditions required to communicate with a service e.g security requirement to communicate with service, protocol and encoding used for binding.

Service Runtime

- It contains the behaviors that occur during runtime of service.
  • Throttling Behavior- Controls how many messages are processed.
  • Error Behavior - Specifies what occurs, when internal error occurs on the service.
  • Metadata Behavior - Tells how and whether metadata is available to outside world.
  • Instance Behavior - Specifies how many instance of the service has to be created while running.
  • Transaction Behavior - Enables the rollback of transacted operations if a failure occurs.
  • Dispatch Behavior - Controls how a message is processed by the WCF Infrastructure.

Messaging

- Messaging layer is composed of channels. A channel is a component that processes a message in some way, for example, by authenticating a message. A set of channels is also known as a channel stack. Channels are the core abstraction for sending message to and receiving message from an Endpoint. Broadly we can categories channels as
  • Transport Channels Handles sending and receiving message from network. Protocols like HTTP, TCP, name pipes and MSMQ.
  • Protocol Channels Implements SOAP based protocol by processing and possibly modifying message. E.g. WS-Security and WS-Reliability.

Activation and Hosting

- Services can be hosted or executed, so that it will be available to everyone accessing from the client. WCF service can be hosted by following mechanism
  • IIS Internet information Service provides number of advantages if a Service uses Http as protocol. It does not require Host code to activate the service, it automatically activates service code.
  • Windows Activation Service (WAS) is the new process activation mechanism that ships with IIS 7.0. In addition to HTTP based communication, WCF can also use WAS to provide message-based activation over other protocols, such as TCP and named pipes.
  • Self-Hosting WCF service can be self hosted as console application, Win Forms or WPF application with graphical UI.
  • Windows Service WCF can also be hosted as a Windows Service, so that it is under control of the Service Control Manager (SCM).

WCF Hosting

We are going to see the four different way of hosting the WCF service. WCF service cannot exist on its own; it has to be hosted in windows process called as host process. Single host process can host multiple servers and same service type can be hosted in multiple host process. As we discussed there are mainly four different way of hosting the WCF service.
Multiple hosting and protocols supported by WCF.Microsoft has introduced the WCF concept in order to make distributed application development and deployment simple.
Hosting Environment Supported protocol
Windows console and form application HTTP,net.tcp,net.pipe,net.msmq
Windows service application (formerly known as NT services) HTTP,net.tcp,net.pipe,net.msmq
Web server IIS6 http, wshttp
Web server IIS7 - Windows Process Activation Service (WAS) HTTP,net.tcp,net.pipe,net.msmq

A summary of hosting options and supported features.
Feature Self-Hosting IIS Hosting WAS Hosting
Executable Process/ App Domain Yes Yes Yes
Configuration App.config Web.config Web.config
Activation Manual at startup Message-based Message-based
Idle-Time Management No Yes Yes
Health Monitoring No Yes Yes
Process Recycling No Yes Yes
Management Tools No Yes Yes

Types of Binding in WCF

BasicHttpBinding

  • It is suitable for communicating with ASP.NET Web services (ASMX)-based services that comfort with WS-Basic Profile conformant Web services.
  • This binding uses HTTP as the transport and text/XML as the default message encoding.
  • Security is disabled by default
  • This binding does not support WS-* functionalities like WS- Addressing, WS-Security, WS-ReliableMessaging
  • It is fairly weak on interoperability.

WSHttpBinding

  • Defines a secure, reliable, interoperable binding suitable for non-duplex service contracts.
  • It offers lot more functionality in the area of interoperability.
  • It supports WS-* functionality and distributed transactions with reliable and secure sessions using SOAP security.
  • It uses HTTP and HTTPS transport for communication.
  • Reliable sessions are disabled by default.

WSDualHttpBinding

This binding is same as that of WSHttpBinding, except it supports duplex service. Duplex service is a service which uses duplex message pattern, which allows service to communicate with client via callback.
In WSDualHttpBinding reliable sessions are enabled by default. It also supports communication via SOAP intermediaries.

WSFederationHttpBinding

This binding support federated security. It helps implementing federation which is the ability to flow and share identities across multiple enterprises or trust domains for authentication and authorization. It supports WS-Federation protocol.

NetTcpBinding

This binding provides secure and reliable binding environment for .Net to .Net cross machine communication. By default it creates communication stack using WS-ReliableMessaging protocol for reliability, TCP for message delivery and windows security for message and authentication at run time. It uses TCP protocol and provides support for security, transaction and reliability.

NetNamedPipeBinding

This binding provides secure and reliable binding environment for on-machine cross process communication. It uses NamedPipe protocol and provides full support for SOAP security, transaction and reliability. By default it creates communication stack with WS-ReliableMessaging for reliability, transport security for transfer security, named pipes for message delivery and binary encoding.

NetMsmqBinding

  • This binding provides secure and reliable queued communication for cross-machine environment.
  • Queuing is provided by using MSMQ as transport.
  • It enables for disconnected operations, failure isolation and load leveling

NetPeerTcpBinding

  • This binding provides secure binding for peer-to-peer environment and network applications.
  • It uses TCP protocol for communication
  • It provides full support for SOAP security, transaction and reliability.

Why ADO.NET is better from ADO?

The ADO.NET is better from ADO by the below reasons-

Tuesday, May 24, 2011

Describe about the various types of generic collections?

There are basically four different types of generic collections which are as follows:-
1. List:-Lists are indexed based Generic Collections. Lists are Generic form of ArrayList.
List helps us to create flexible strong type collection as you can see in below code snippet i have defined List as "int" and "string".

////index based Generic collection           
List<int> ObjInt = new List<int>();        
ObjInt.Add(123);           
ObjInt.Add(456);           
Console.WriteLine(ObjInt[0]); //accessing the List by internal index based value.           
List<string> ObjString = new List<string>();           
ObjString.Add("feroz");

2. Dictionary:-Dictionary are key based generics collection.

Dictionary are generic form of Hashtable.

////key based Generic collection           
Dictionary<int, int> ObjDict = new Dictionary<int,int>();           
ObjDict.Add(1,2);           
Dictionary<int, string> ObjDict1 = new Dictionary<int,string>();           
ObjDict1.Add(3, "feroz is a developer");           
ObjDict1.Add(4, "wasim is a developer");           
Console.WriteLine(ObjDict1[3]); //accessing the dictionary by defined key.

3. Stack:-Stack generic collection allows you to get value in "LIFO"(last in first out) manner.

//// Stack            
Stack<string> ObjStack = new Stack<string>();           
ObjStack.Push("feroz");           
ObjStack.Push("moosa");           
Console.WriteLine(ObjStack.Pop());

4. Queue:-Queue generic collection allows you to get value in "FIFO"(first in first out) manner.

////Queue           
Queue<int> ObjStr = new Queue<int>();           
ObjStr.Enqueue(789);           
ObjStr.Enqueue(456);           
Console.WriteLine(ObjStr.Dequeue());

What are endpoints, address, contracts and bindings?

Elaborate different types of assemblies?

In .NET there are basically three different types of assemblies as follows.
1.Private assemblies:-A private assembly is normally used by a single application and is stored in the application's directory.
2.Public/shared assemblies:- A shared assembly is normally stored in the global assembly cache which is a repository of assemblies maintained by the .NET runtime.
3.satellite assemblies:-Satellite assemblies are often used to deploy language-specific resources for an application. These language-specific assemblies work in side-by-side execution because the application has a separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language.

Wednesday, May 18, 2011

Master Page Life Cycle

Master Page sequence of events / Life Cycle


1) Master Controls Init
2) Content Controls Init

3) Master Page Init
4) Content Page Init

5) Content Page Load
6) Master Page Load

7) Master Controls Load
8) Content Controls Load

9) Content Page PreRender
10) Master Page PreRender

11) Master Control PreRender
12) Content Control PreRender

13) Master Controls Unload
14) Content Controls Unload

15) Master Page Unload
16) Content Page Unload

--Kishore


For more detailed explanation about Master & Content page event. Go through the below link
http://odetocode.com/articles/450.aspx
http://englestone.blogspot.com/2008/06/master-page-sequence-of-events.html

Monday, May 16, 2011

difference between window.onload and document.ready

Document.ready() function is different from body onload() function because off 2 reasons.

1. We can have more than one document.ready() function in a page where we can have only one onload function.
2. Document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page. 

Monday, May 9, 2011

Tuesday, April 19, 2011

Assign session value in javascript

Here is the code..


 var myvar"Hey Buddy";
'<%Session["temp"] = "' + myvar +'"; %>' ;
alert('<%=Session["temp"] %>');

Sunday, April 3, 2011

WCF Service is composed of three components:


Service class: It implements the service needed.
Host environment: is an environment that hosts the developed service.
Endpoints: are the connection points for the clients to connect to the service. Clients find the end points through three components like service contract, binding, and address.

Explain how garbage collection deals with circular references.


Circular referencing issue happens when two objects refer to each other. Usually in a parent-child relationship, situations occur where a child interacts with the parent object and has a reference held to the parent object.

The .NET, the objects that are reachable from the root can be cleaned up easily. Thus, this can even be applied to circular reference and have the objects holding the resources cleaned up

Saturday, March 19, 2011

Ajax life cycle:

A Typical Life Cycle or Process of AJAX
Life cycle of AJAX is more similar to a traditional GUI than a traditional web application. It has DOM objects who acts like GUI widgets. The used script has capacity to register even listeners on DOM objects and respond accordingly after manipulating DOM.
There is an important part of the event-processing cycle in server is evoked sometimes. As the server calls are asynchronous, the even listening and event responding are done separately.
The normal AJAX life cycle consists of following stages:
1. The webpage is visited by internet users simply by clicking the targetted link or searching an URL. Thereafter the page gets initialised and loaded. In order to handle the user input callbacks are present in the system which acts after this.
2. When a key is pressed it’s called an event which is a query or click in common words. On such events browser sends the information request to the server which in turn responds to give back required information as bites.
3. The response of the server is translated through callback process to made viewable to the user.
4. The callback function then updates the DOM objects and javascript variables if present.
5. Generally the process of requesting information and giving callbacks are free to server to increase convenience and speed.
6. Some AJAX applications are short term and terminated once the request is completed.

Friday, March 4, 2011

What are VSDISCO files?


      VSDISCO files are DISCO files that enable dynamic discovery of Web Services. ASP.NET links the VSDISCO to a HTTP handler that scans the host directory and subdirectories for ASMX and DISCO files and returns a dynamically generated DISCO document. A client who requests a VSDISCO file gets back what appears to be a static DISCO document