Thursday, February 5, 2015

What is AJAX Helpers in ASP.NET MVC

Ajax helper in ASP.NET MVC essentially provides Ajax functionality for your web applications. AJAX Helpers are used for creating AJAX enabled elements for example Ajax enabled forms and links which performs request asynchronously. when you use Ajax helper you can submit your HTML form using Ajax so that instead of refreshing the full web page only a part of it can be refreshed. you can render action links that allow you invoking action methods using Ajax. Basically AJAX Helpers are extension methods of AJAX Helper class which exists in System.Web.Mvc.Ajax namespace.

AJAX-enabled link based example:-

Here I have created a example to show how to use AJAX action link using action and controller in Asp.Net MVC.

@Ajax.ActionLink("Fatch Data""GetData"new AjaxOptions {UpdateTargetId = "Data-container", HttpMethod = "GET" })


Unobtrusive AJAX in MVC?

Unobtrusive Validation and AJAX support in  MVC follows  best practices that enable Progressive Enhancement and also easy to use. The unobtrusive AJAX library (not the unobtrusive validation library) is admittedly a bit limited in functionality, but if it fulfill the requirements of the application you are writing, then by all means use it. And because the source code of it is in your app (it's JavaScript, after all), it's generally straightforward to make any updates or changes to it as you see fit.
Configuration options for AJAX Helpers
 It is very important to know the AjaxOptions class defines properties that allow you to specify callbacks for different stages in the AJAX request life cycle. There are several properties in AjaxOptions. Now You can use these property as par different scenario and different requirements. There are following properties provided by AjaxOptions class for AJAX helpers:

Url : Specify the URL that will be requested from the server.

Confirm: Specify a message that will be displayed in a confirm dialog to the end user.When user
clicks on OK button in the confirmation dialog, the Ajax call performs.

OnBegin: Specify a JavaScript function name which is called at the beginning of the Ajax request.

OnComplete: Specify a JavaScript function name which is called at the end of the Ajax request.

OnSuccess:  Specify a JavaScript function name which is called when the Ajax request is successful.

OnFailure:  Specify a JavaScript function name which is called if the Ajax request fails.

LoadingElement:  Specify progress message container’s Id to display a progress message or animation to the end user while an Ajax request is being made.

LoadingElementDuration: Specify a time duration in milliseconds that controls the duration of the progress message or animation.

UpdateTargetId: Specify the target container’s Id that will be populated with the HTML returned by the
action method.
InsertionMode: Specify the way of populating the target container. The possible values are InsertAfter, InsertBefore and Replace (which is the default).

Cross Domain AJAX (CORS)?
Cross-domain requests require mutual consent between the Web page and the server. You can initiate a cross-domain request in your Web page by creating an XDomainRequest object off the window object and opening a connection to a particular domain. The browser will request data from the domain's server by sending an Origin header with the value of the origin. It will only complete the connection if the server responds with an Access-Control-Allow-Origin header of either * or the exact URL of the requesting page. By default in ASP.NET MVC, any web browsers allows AJAX calls only to our web application’s site of origin. This will allow us to prevent various security issues. In that case, you have two options: Either add CORS header "Access-Control-Allow-Origin: *" to the response (and configure the client ajax() call with dataType:"html"), or create a special JSON(P) page that delivers the same data as JSON (with padding) (and configure the client ajax() call like in the OP, with dataType:"jsonp").

If you like this post share it.. If you encounter any problems, feel free and comment below to find solution. Share Your Experience with us.


Monday, February 2, 2015

Personal and Technical Interview Question for Fresher


Today, I am sharing interview question which I have faced during interview at fresher time. I have combined all round interview question which had asked to me in one group. I hope it will help to fresher. 


First Interview [HCL]


1. Tell about your technical profile.
2. What was your role in your project?
3. In which module you have worked explain?
4. Describe GridView events (Paper).
5. How to change Label's color based on Label's value  (Paper)?
6. Write the code to perform edit and delete operations using  GridView (Paper).
7. What are the Validation controls in ASP.Net?
8. How you will implement Custom Validator Control functionality (Paper)?
9. What are Generics?
10. What is the  difference between HashTable and Dictionary?
11. What is Ajax and  Jquery?
12. Which control have you used in AJAX?
13. What is the use of ModalPopUpExtender (Paper)?
14. WCF Basics (Types of binding)
15. What are Database Constraints?
16. Difference between Primary and Unique key?
17. Difference between Function and Procedure?
18. Can we store DataSet in View State?
19. When we will store DataSet in Session then which memory will be filled client side or server side?
20. Difference between reference and out parameter?
21. How to execute stored procedure?


Second Inerview [ ExcelSoft Technologies Pvt. Ltd. ]

1. What is View State?
2. Where is View State is saved and how View State value is retained
between Post Back. (Practical)?
3. Form Authentication Process (Using Web.Config file and Database in paper).
4. If View State value is "X" and I have changed it to "Y" in Page_Load
then what will be the final value of View State?
5. Page Life cycle with use.
6. Performance Analyzer tool.
7. How to declare unique key?
8. Diff. between Equi join and Right outer join (Paper)?
9. Define Caching types.
10. How to implement SQL Cache (Paper)?
11. How to call Web service using AJAX (Paper)?
12. How to change Color of Label using Jquery (Paper)?
13. What is Table Object/Variable?
14. How to call stored procedure using Entity Framework?
15. What is the difference between Overloading and Overriding?
16. What is the difference between ExecuteScalar() and ExecuteNonQuery()?
17. What if I will pass Select * in ExecuteScalar()?

Third Inteview [ NIIT ]

1. Tell me about projects.
2. Your role in project.
3. Which performance tool you have used?
4. Define abstract class and interface?
5. Why to use static members?
6. What is partial class and advantages?
7. GridView and DataList differences.
8. State Management type.
9. What is view state and use?
10. Caching techniques.
11. WCF and Web service differences.
12. Define WCF contracts.
13. Define design pattern.
14. What is facade pattern?
15. Triggers use and types.
16. Define cursor.
17. Difference between clustered and non-clustered index.
18. How many clustered index can be declared for a table.
19. What is view?
20. What is AJAX and Update-panel?
21. If you have 2 Update-panel then how to update one update panel from second?


Fourth Interview [ IDC Technology]


1. Define your Technical skills.

2. Your Role in project.
3. Define features of OOPS.
4. How you will replace the functionality of parent class function in
child class.(Paper)
5. Difference between Interface and abstract class (Use).
6. Functions of CLR.
7. Where you will use Cookie, Session and View State.
8. What are InProc and OutProc Session?
9. If you will save session in OutProc then where it will be saved.
and when it will be expired.
10. Difference between Web service and WCF
11. Design pattern.
12. Write sequence of select query-

 [ WITH ]
SELECT select_list [ INTO new_table ]
 [ FROM table_source ]
 [ WHERE search_condition ]
[ GROUP BY group_by_expression ]
[ HAVING search_condition ]
[ ORDER BY order_expression [ ASC | DESC ] ]

The UNION, EXCEPT and INTERSECT operators can be used between queries
to combine or compare their results into one result set.


Fifth Interview [ JAGBROS ]

1. What is ROW_NUMBER () in SQL Server?
2.  Difference between Union and Join.
3. Return value for ExecuteNonQuery().
4. Can we execute DML command in ExecuteScalar()?
5. Difference between DataSet and DataReader.
6. If provider is given OracleClient then can we connect with SQL Server?

7. Where you have used JQuery in your project?
8. Namespace for web-part (SharePoint)    - System.Web.UI.WebControls.WebParts Namespace
9. For creating a site what are the main concepts you need to consider in UL layer, middle-ware and      database Layer.




If you like this post share it.. If you encounter any problems, feel free and comment below to find solution. Share Your Experience with us.


Sunday, February 1, 2015

Brief Introduction of Linq



Today I am going to explain a very good topic....Linq. So, First question is What is Linq. Linq is basically stand for Language-Integrated Query. Basically LINQ address the current database development model in the context of Object Oriented Programming Model. If you wants to develop database application on .Net most of us prefer to use ADO.Net. ADO.Net is working as middle ware in application and give us complete object oriented wrapper around the database SQL.

So Programmer must have good knowledge of object oriented programming concept as well as SQL to develop an application. But incase of Linq SQL statements are become part of the C# and VB.Net code so there are less chance of mistake.

Type of Linq


1.               Linq to Objects

When you use Linq to object than It gives you  the facility to query any kind of C# in-memory objects, like as lists, generic list arrays and other collection types.Linq to object query returns IEnumerable collection. It gives a approach to query collection with filtering, grouping and ordering with minimum code.

2.               Linq to Ado.Net

When you use Linq to Ado.Net, It has different flavors of Linq to query data from different databases like as Microsoft SQL Server, Oracle, and others. It has following flavours

2.1.               Linq to Sql

 It is designed to work with Sql Server database. It gives us run-time infrastructure for managing relational data as objects. Linq to Sql  also supports transactions, views and stored procedures etc. It is an object-relational mapping  framework that allow  us to create 1-1 mapping of Sql Server database to .net classes. In this  classes that match the database table are created automatically from the database.

2.2.               Linq to Dataset

It is an very easy and we can say a faster way to query data cached in the DataSet object. It also allow us Linq to query over any type of database  that can be query with Ado.Net.

2.3.               Linq to Entities

It basically use when you are using entity framework. It is very similar to Linq to Sql. It uses a conceptual Entity Data Model . The Ado.Net Entity Framework has improved in .NET framework 4.0/.NET framework 4.5 to query any type of database like Sql Server, DB2, Oracle, MySql, and many more.

3.               Linq to Xml

It is created for xml programming interface.  System.Xml.Linq namespace contains classes for Linq to Xml. When you use this you can query, modify xml document and also save document after modification.

4.               Parallel Linq (PLinq)

PLinq is introduced by Microsoft in  .Net framework 4.0. It extends the feature of Linq  to Objects with a new parallel programming library. when you use this, you  can break/split up a query to execute simultaneously/parallel on different processors.


If you like this post share it.. If you encounter any problems, feel free and

comment below to find solution. Share Your Experience with us.