.Net Interview Questions and Answers

Search:

QuestPond's Interview Questions & Answers on ASP.NET MVC(Model View Controller)

By : Shiv Prasad Koirala | Aug 6th, 2014 | Views : 3904 | Comments : 0 Bookmark and Share

What is the advantage of using HTML helper classes for creating input controls?


In MVC (Model View Controller) we have two options for creating Input controls. Either we can use pure html controls or we can use HTML helper classes which internally generates input controls.


The advantages of using HTML helper classes are: -


  1. Compared to pure html development will be faster with HTML helper classes.

  2. Developer is no more worry about the name of control. It will be automatically handled by HTML helper control.

  3. When controls are generated using HTML helper classes they have the ability to populate there values from the current posted data.


Let's elaborate above point a little.


a. Let's create Customer Model class as follows: -



b. Let say we have a view named MyView of containing a HTML form as follows: -




c. Create SaveCustomer Action as follows.



d. Now create a new strongly typed View called HtmlHelperView of type Customer inside current controller folder as follows,



e. Now execute the application and make a request for an action method which will return MyView.


You will notice that CustomerName in the First will be repopulated in the CustomerNametexbox in the seconview.



For technical trainings on various topics like WCF(Windows Communication Foundation), MVC(Model View Controller), Business Intelligence, Design Patterns, WPF, TFS and Basic fundamentals feel free to contact SukeshMarla@Gmail.com or visit www.sukesh-marla.com


For more stuff like this, click here. Subscribe to article updates or follow at twitter @SukeshMarla


See the following MVC(Model View Controller)video on viewdata, viewbag, tempdata & session:-



Click and see here for more step by step training in ASP.NET MVC

 
Rate this Article :
1 Star
2 Stars
3 Stars
4 Stars
5 Stars
1 1 1 2 1
 
 
 
 

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

Article Categories

Learn in Hindi