Wednesday, 31 July 2013

What is DataView in asp.net with Example? What are the advantages?


A DataView provides various views of the data stored in a DataTable. Using a DataView, you can expose the data in a table with different sort orders, and you can filter the data by row state or based on a filter expression.

DataView Example:

public void BindGridDataAll()
    {
        DataSet ds = new DataSet();
       //Get data from database and fill into dataset        
        ds = ObjClass.GetData();
        dvData = ds.Tables[0].DefaultView;
        // Here we specify which column you want to sort
         dvData.Sort = "SortString";
         GridView.DataSource = dvData;
         GridView.DataBind();
    }

C# - How to add DataTable to DataSet and DataSet to DataTable in asp.net?


Dataset

DataSet objects are in-memory representations of data. They contain multiple Datatable objects, which contain columns and rows, just like normal database tables. You can even define relations between tables to create parent-child relationships. The DataSet is specifically designed to help manage data in memory and to support disconnected operations on data, when such a scenario make sense. The DataSet is an object that is used by all of the Data Providers, which is why it does not have a Data Provider specific prefix.


Data Table

Data table is a collection of records that consist the single table. You can get dataTable from dataset as follows.

How to create a setup project for a Windows Service application in Visual C#


Requirements
The following list outlines the recommended hardware, software, network infrastructure, and service packs that you must have:
  1. Microsoft Windows 2000, Windows XP, Windows Server 2003, or a later Microsoft operating system with the .NET Framework installed
  2. Microsoft Visual Studio .NET Enterprise, Microsoft Visual Studio .NET Enterprise Architect, Microsoft Visual Studio 2005, or Microsoft Visual Studio 2008.

Saturday, 27 July 2013

Types of Bindings in WCF

Basic binding

Offered by the BasicHttpBinding class, basic binding is designed to expose a WCF service as a legacy ASMX web service so that old clients can work with new services. The basic binding makes your service look, on the wire, like a legacy web service that communicates over the basic web service profile. When used by clients, this binding enables new WCF clients to work with old ASMX services.

TCP binding

Offered by the NetTcpBinding class, TCP binding uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.

Features of WCF



WCF includes the following set of features. For more information, see WCF Feature Details.

  • Security 

    Messages can be encrypted to protect privacy and you can require users to authenticate themselves before being allowed to receive messages. Security can be implemented using well-known standards such as SSL or WS-Secure Conversation. For more information, see
     Windows Communication Foundation Security.

WCF interview questions



          Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types. 

            WCF is part of .NET 3.0 and requires .NET 2.0, so it can only run on systems that support it.

             It is a Software development kit for developing services on Windows. WCF is introduced in .NET 3.0. In the System.ServiceModel namespace. WCF is based on basic concepts of Service oriented architecture (SOA)

1)      What are contracts in WCF?

In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does.

WCF defines four types of contracts.

Friday, 26 July 2013

Web Service interview questions



1)      What is the Web service protocol stack?

The Web service protocol stack is an evolving set of protocols used to define, discover, and implement Web services. The core protocol stack consists of four layers:

Service Transport: This layer is responsible for transporting messages between applications. Currently, this includes HTTP, SMTP, FTP, and newer protocols, such as Blocks Extensible Exchange Protocol (BEEP).

Thursday, 25 July 2013

How to validate two dates difference in JavaScript


In this article I will explain how to validate two dates difference in JavaScript.

function CompareDateTest(txtfrom, txtto) {


        var From = document.getElementById(txtfrom).value;
        var To = document.getElementById(txtto).value;
      
        var POdmy = From.split("/");
        var IVdmy = To.split("/");

What is Web Service? What are the key web service technologies? What are the advantages?


In this article I will explain what is Web Service? What are the key web service technologies? What are the advantages?

A Web Service is a software program that uses XML to exchange information with other software via common internet protocols. In a simple sense, Web Services are a way for interacting with objects over the Internet.


JavaScript Interview Questions



1)      What is JavaScript?

            JavaScript is a scripting language most often used for client-side web development.

2)       Difference between Java & JavaScript
 Listed are key differences between the Java and JavaScript.

1.       Java is an OOP programming language while Java Script is an OOP scripting language.
2.       Java creates applications that run in a virtual machine or browser while JavaScript code is run on a browser only.
3.       Java code needs to be compiled while JavaScript codes are all in text.
4.       They require different plug-ins.

What is JavaScript? What are the key difference between Java and JavaScript? What are the advantages and disadvantage?


In this article I will explain what is JavaScript? What are the key difference between Java and JavaScript? What are the advantages and disadvantage? What is JavaScript?

JavaScript is a scripting language designed primarily for adding interactivity to Web pages and creating Web applications.

JavaScript is one of the most simple, versatile and effective languages used to extend functionality in websites. Uses range from on screen visual effects to processing and calculating data on web pages with ease as well as extended functionality to websites using third party scripts among several other handy features, however it also possesses some negative effects that might make you want to think twice before implementing JavaScript on your website. Let's look at some of its pros and cons.

TabContainer Example


            In this article I will explain what are ASP.NET AJAX TabContainer and TabPanel with Example?

TabContainer is an ASP.NET AJAX Control which creates a set of Tabs that can be used to organize page content. A TabContainer is a host for a number of TabPanel controls.

Each TabPanel defines its HeaderText or HeaderTemplate as well as a ContentTemplate that defines its content. The most recent tab should remain selected after a postback, and the Enabled state of tabs should remain after a postback as well.

What are TabContainer and TabPanel? What are the Properties of TabContainer and TabPanel?


In this article I will explain what are AJAX TabContainer and TabPanel? What are the Properties of TabContainer and TabPanel?

TabContainer is an ASP.NET AJAX Control which creates a set of Tabs that can be used to organize page content. A TabContainer is a host for a number of TabPanel controls.

Each TabPanel defines its HeaderText or HeaderTemplate as well as a ContentTemplate that defines its content. The most recent tab should remain selected after a postback, and the Enabled state of tabs should remain after a postback as well.

What is the difference between dataTable and dataset?


Dataset

DataSet objects are in-memory representations of data. They contain multiple Datatable objects, which contain columns and rows, just like normal database tables. You can even define relations between tables to create parent-child relationships. The DataSet is specifically designed to help manage data in memory and to support disconnected operations on data, when such a scenario make sense. The DataSet is an object that is used by all of the Data Providers, which is why it does not have a Data Provider specific prefix.

Example for dataset: 

What is ADO.NET?



In this article I will explain what is ADO.NET?

ADO is a language-neutral object model that is the keystone of Microsoft's Universal Data Access strategy.

ADO.NET is an integral part of the .NET Compact Framework, providing access to relational data, XML documents, and application data. ADO.NET supports a variety of development needs. You can create database-client applications and middle-tier business objects used by applications, tools, languages or Internet browsers.




Wednesday, 24 July 2013

How to use JQuery and JSON to call asp.net page methods.



In this article I will explain how to use JQuery and JSON to call asp.net page methods.

Description:   

              Generally we will create static web methods in webservice and we will use those methods to call it from JQuery instead of that directly we can create static methods with [WebMethod] attribute in our code behind file and use those methods from JQuery.

If we want to call our page methods with JQuery then we need to use JQuery.ajax method and our JQuery declaration will be like this

Tuesday, 23 July 2013

What is jQuery? What are features available? What is the Syntax of jQuery and examples?



In this article I will explain what is jQuery? What are features available? What is the Syntax of jQuery and examples?

The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery is not a language, The JQuery library is a single JavaScript file, containing all of its common DOM, event, effects, and Ajax functions. It can be included within a web page by linking to a local copy, or to one of the many copies available from public servers.

Monday, 22 July 2013

MVC Interview questions and answers


About ASP.Net MVC

The ASP.Net MVC is the framework provided by Microsoft that lets you develop the applications that follows the principles of Model-View-Controller (MVC) design pattern.
The .Net programmers new to MVC thinks that it is similar to WebForms Model (Normal ASP.Net), but it is far different from the WebForms programming. This article will tell you how to quick learn the basics of MVC along with some frequently asked interview questions and answers on ASP.Net MVC

1. What are the 3 main components of an ASP.NET MVC application?

1. M - Model
2. V - View
3. C – Controller

What is MVC? Advantages and Disadvantages of asp.net MVC framework?



In this article I will explain what is MVC? What are the main advantages and disadvantages of asp.net MVC framework?

MVC is a framework for building web applications using a MVC (Model-View-Controller) design:
  1. The Model represents the application core (for instance a list of database records).
  2. The View displays the data (the database records).
  3. The Controller handles the input (to the database records).
Model: It is the part of the application that handles the logic for the application data. Often model objects retrieve data (and store data) from a database.

Friday, 19 July 2013

SQL Server Interview Questions


  1. What is a Stored Procedure?
A stored procedure is a group of sql statements that has been created and stored in the database. Stored procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. Stored procedure will reduce network traffic and increase the performance. If we modify stored procedure all the clients will get the updated stored procedure.
  1. What's the difference between a primary key and a unique key?
Both primary key and unique key enforces uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.

Thursday, 18 July 2013

ASP.NET Access Modifiers ?




The main purpose of using access specifiers is to provide security to the applications.   Access Modifiers (Access Specifiers) describes as the scope of accessibility of an Object and its members. All C# types and type members have an accessibility level. We can control the scope of the member object of a class using access specifiers. We are using access modifiers for providing security of our applications. When we specify the accessibility of a type or member we have to declare it by using any of the access modifiers provided by C# language.

           when we use Access Specifiers in C# they help the other class members to know how they can access the methods or variables declared/defined inside another class.

C# supports five types of access specifiers to tell the extent of visibility of a class member. They are:-

  • public,
  • private,
  • protected,
  • internal or friend,
  • protected internal or protected friend

Wednesday, 17 July 2013

what is encryption and decryption with example? how to encrypt and decryption password in c# ?


In this article I will explain what is encryption and decryption with example

Encryption is the process of translating plain text data into something that appears to be meaningless and random. Encryption is a great way to keep valuable data safe—whether you’re transmitting it over the Internet, backing it up on a server, or just carrying it through airport security on your laptop. Encrypting your data makes it completely unreadable to anyone but you or its intended recipient.

Monday, 15 July 2013

What is WCF (Windows Communication Foundation)? How many types of bindings are there in WCF? And WCF Features?


In this article I will explain what is WCF (Windows Communication Foundation)? How many types of bindings are there in WCF? And WCF Features?

WCF is a framework for building service-oriented application. You can send data as asynchronous messages from one service endpoint to another. This is great network distributed system developed by Microsoft for communication between applications.

WCF Architecture:


Saturday, 13 July 2013

What is authentication and authorization? Types of authentication and authorization mechanisms?


In this article I will explain What is authentication and authorization and what are the basic security settings and types of authentication and authorization mechanisms.

Authentication :

Authentication knows the identity of the user.

Authorization :

Authorization is deciding whether a user is allowed to perform an action.

Configure the security settings in Web.config file:

This section demonstrates how to add and modify the <authentication> and <authorization> configuration sections to configure the ASP.NET application to use forms-based authentication.
1.      In Solution Explorer, open the Web.config file.
2.      Change the authentication mode to Forms.
3.      Insert the <Forms> tag, and fill the appropriate attributes. (For more information about these attributes, refer to the MSDN documentation or the QuickStart documentation that is listed in the REFERENCES section.) Copy the following code, and then click Paste as HTML on the Edit menu to paste the code in the <authentication> section of the file:
<authentication mode="Forms">
   <forms name=".ASPXFORMSDEMO" loginUrl="logon.aspx"
   protection="All" path="/" timeout="30" />
</authentication>
                                                                 
4.      Deny access to the anonymous user in the <authorization> section as follows:
<authorization>
   <deny users ="?" />
   <allow users = "*" />
</authorization>


Types of authentication and authorization

There are three ways of doing authentication and authorization in ASP.NET:-

 Windows authentication: - In this methodology ASP.NET web pages will use local windows users and groups to authenticate and authorize resources.

 Forms Authentication: - This is a cookie based authentication where username and password are stored on client machines as cookie files or they are sent through URL for every request. Form-based authentication presents the user with an HTML-based Web page that prompts the user for credentials.

• Passport authentication: - Passport authentication is based on the passport website provided
by the Microsoft .So when user logins with credentials it will be reached to the passport website (i.e. hotmail,devhood,windows live etc) where authentication will happen. If Authentication is successful it will return a token to your website.

Friday, 12 July 2013

DataList in ASP.NET using C#


In this article I will explain what is datalist control in ASP.NET? how to bind data to Dalalist ?

The DataList control like the Repeater control is a template driven, light weight control, and acts as a container of repeated data items. The templates in this control are used to define the data that it will contain. It is flexible in the sense that you can easily customize the display of one or more records that are displayed in the control. You have a property in the DataList control called RepeatDirection that can be used to customize the layout of the control.

Thursday, 11 July 2013

How to create Web application with Basic Operations like SAVE , UPDATE , DELETE ?


Open Visual Studio and follow the below steps to open a web application.

The Steps are:-

1)      Go to Menu Bar and Click on “File” Menu.
2)      Click on “New”.
3)      Click on “Project”. Then a window will appear.
4)      Click on Visual C# and expand it.
5)      Select “web” option from Visual C#.
6)      Select ASP.NET Web Application.
7)      Give the name of the web application and also the directory to store the web application.
8)      Then a solution is created for that web application.

Wednesday, 10 July 2013

Export DataTable Data to Excel in ASP.NET


In this article I will show you how to Data Table Data export to excel in asp.net c#. First you need to create a new web project or Web Site. Create a Data Table on page, and write code to bind the Data Table.



protected void ImgBtnDownLoad_Click(object sender, ImageClickEventArgs e)
    {
        ExportToExcel("Report.xlsx");
    }


Tuesday, 9 July 2013

What is Agile Methodology and Advantages? What is difference between Waterfall and Agile methodologies?


In this article I will explain what Agile Methodology is and what advantages are available? And what is difference between waterfall and agile methodologies.

Agile methodology means cutting down the big picture into puzzle size bits, fitting them together when the time is right e.g. design, coding and testing bits.
Agile model believes that every project needs to be handled differently and the existing methods need to be tailored to best suit the project requirements. In agile the tasks are divided to time boxes (small time frames) to deliver specific features for a release.


Monday, 8 July 2013

How to send email in ASP.NET ?


In this article I will explain how to send email using asp.net

Properties explained:

SmtpServer: The name the SMTP server that will be used to send the emails.

SmtpPort: The port the server will use to send SMTP transactions (emails).

Add below two namespaces to your web page

using System.Net.Mail;
using System.Net;

Sunday, 7 July 2013

What is Waterfall Methodology ? Advantages & Disadvantages


It's development method in which work “flows down” from one stage into the next stage. Each stage must be completed before the next stage can begin, and returning to a previous stage is often not permissible. 




Saturday, 6 July 2013

Export Gridview Data to Excel in ASP.NET


In this article I will show you how to gridviewexport to excel in asp.net C#.NET. first you need to create a new web project or WebSite. Create a gridview on page, and write code to bind the gridview.

protected void btnGenerateExcel_Click(object sender, ImageClickEventArgs e)
    {
            DataSet DataSetName=new DataSet();
            DataSetName = // Assign Data to DataSet
            GridView.DataSource = DataSetName;
            GridView.DataBind();
            ExportToExcel("Report.xlsx", GridView);
           }

Friday, 5 July 2013

Basic SQL Commands with Example



Select Command :

The SELECT statement is used to select data from a Table.

Insert Command :

The first form does not specify the column names where the data will be inserted, only their values:

INSERT INTO Employee
VALUES ('Ravi','21/04/1986','Male','21/04/2011');


Thursday, 4 July 2013

ADO.NET Concepts


ADO.NET

ADO.NET includes many objects you can use to work with data. This section introduces some of the primary objects you will use. Over the course of this tutorial, you'll be exposed to many more ADO.NET objects from the perspective of how they are used in a particular lesson. The objects below are the ones you must know. Learning about them will give you an idea of the types of things you can do with data when using ADO.NET.

SqlCommand
The process of interacting with a database means that you must specify the actions you want to occur. This is done with a command object. You use a command object to send SQL statements to the database. A command object uses a connection object to figure out which database to communicate with. You can use a command object alone, to execute a command directly, or assign a reference to a command object to an SqlDataAdapter, which holds a set of commands that work on a group of data as described below.

Reading Excel From C# using OLEDB Connection

In this article i will explain how to read Excel sheet in C#.NET using OLEDB Connection.

First, You need to add below name spaces to read Excel file in OLEDB

using System.Data.OleDb;
using System.Configuration;
using System.Data.SqlClient;

And we need establish a connection to the Database and OLEDB. Add below connection code in web.config file

Wednesday, 3 July 2013

OOPS Concepts in asp.net


Class:

 It is a collection of objects.

Object:

It is a real time entity.
An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior.

Example :
public class Parent
{
}
Parent objParent=new Parent ();

Gridview validation using JavaScript


In this article I will explain how to validate GridViewtextbox in JavaScript

I  can give u idea how to find gridviewtextbox using javascript here.I have done validation for country which is inside in grid.
you can also find your both textboxes in this way and compare that.

Tuesday, 2 July 2013

ASP.NET 3.5 4.0 Interview Questions Answers ?


1. What is .NET 4.0?

It is latest version of DotNet framework offered by microsoft to develop software applications.

2. What is .NET framework 4.0

.NET is a new framework produced by microsoft for developing and running software applications which includes web,desktop and mobile applications. It supports veriety of programming languages like C#,VB,C++,Java etc

ASP.NET 2.0 Interview Questions


The Q&A mentioned over here have been taken from forums, my colleagues and my own experience of conducting interviews. I have tried to mention the contributor wherever possible. If you would like to contribute, kindly use the Contact form. If you think that a credit for a contribution is missing somewhere, kindly use the same contact form and I will do the needful.

Check out the other interview questions over here:
General .NET Interview Questions
.NET Framework Interview Questions

ASP.NET 2.0 Interview Questions - Intermediate Level

What is ASP and ASP.NET? What is the basic difference between ASP and ASP.NET?


1. What is ASP?
Active Server Pages (ASP), also known as Classic ASP, is a Microsoft's server-side technology, which helps in creating dynamic and user-friendly Web pages. It uses different scripting languages to create dynamic Web pages, which can be run on any type of browser. The Web pages are built by using either VBScript or JavaScript and these Web pages have access to the same services as Windows application, including ADO (ActiveX Data Objects) for database access, SMTP (Simple Mail Transfer Protocol) for e-mail, and the entire COM (Component Object Model) structure used in the Windows environment. ASP is implemented through a dynamic-link library (asp.dll) that is called by the IIS server when a Web page is requested from the server.
2. What is ASP.NET?

ASP.NET interview questions ?


What is difference between constants, read-only and, static?

Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

What is the cross page post backing?

Asp.Net 2.0 fixed this with built-in features that allowed us to easily send information from one page to another.