Professionallearn.com

[ Log On ]
< <
 

ARTICLES

Submitted by:P.K.R
5/16/2013 12:00:00 AM
Language: Asp.net MVC

 

 

MVC means ?


 

MVC stands for Model View Controller.
It divides an application into 3 component roles which is based on a framework methodology.
These component roles are discussed briefly as follows:

i) Models : These component roles are used to maintain the state which is persisted inside the Database.

Example: we might have a Product class that is used to represent order data from the Products table inside SQL.

ii) Views : These component roles are used to display the user interface of the application, where this UI is created off of the model data.

Example: we might create an Product “Edit” view that surfaces textboxes, dropdowns and checkboxes based on the current state of a Product object.

iii) Controllers : These component roles are used for various purposes like handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI.

Note:

In a MVC application, the views are used only for displaying the information whereas the controllers are used for handling and responding to user input and interaction.

 

Which assembly is used to define the MVC framework and Why ?


 

The MVC framework is defined through System.Web.Mvc assembly.
This is because this is the only assembly which contains classes and interfaces that support the ASP.NET Model View Controller (MVC) framework for creating Web applications.

 

How can we plug an ASP.NET MVC into an existing ASP.NET application ?


 

We can combine ASP.NET MVC into an existing ASP.NET application by following the below procedure:

First of all, you have to add a reference to the following three assemblies to your existing ASP.NET application:

i) System.Web.Routing
ii) System.Web.Abstractions
iii) System.Web.Mvc

The ASP.NET MVC folder should be created after adding these assembly references.
Add the folder Controllers, Views, and Views | Shared to your existing ASP.NET application.
And then you have to do the necessary changes in web.config file.
For this you can refer to the below link:

http://www.packtpub.com/article/mixing-aspnet-webforms-and-aspnet-mvc

 

What are the advantages of using asp.net mvc ?


 

The main advantages of using asp.net mvc are as follows:

i) One of the main advantage is that it will be easier to manage the complexity as the application is divided into model,view and controller.
ii) It gives us the full control over the behavior of an application as it does not use view state or server-based forms.
iii) It provides better support for test-driven development (TDD).
iv) You can design the application with a rich routing infrastructure as it uses a Front Controller pattern that processes Web application requests through a single controller.

 

Explain about Razor View Engine ?


 

This Razor View engine is a part of new rendering framework for ASP.NET web pages.
ASP.NET rendering engine uses opening and closing brackets to denote code (<% %>), whereas Razor allows a cleaner, implied syntax for determining where code blocks start and end.

Example:

In the classic renderer in ASP.NET:


<ul>


<% foreach (var userTicket in Model)


  { %>


    <li><%: userTicket.Value %></li>


<%  } %>


</ul>

 



By using Razor:

<ul>


@foreach (var userTicket in Model)


{


  <li>@userTicket.Value</li>


}


</ul>

 

 

Does the unit testing of an MVC application is possible without running controllers in an ASP.NET process ?


 

In an MVC application, all the features are based on interface. So, it is easy to unit test a MVC application.
And it is to note that, in MVC application there is no need of running the controllers for unit testing.

 

Which namespace is used for ASP.NET MVC ?


 

System.Web.Mvc namespace contains all the interfaces and classes which supports ASP.NET MVC framework for creating web applications.

 

Can we share a view across multiple controllers ?


 

Yes, It is possible to share a view across multiple controllers by putting a view into the shared folder.
By doing like this, you can automatically make the view available across multiple controllers.

 

What is the use of a controller in an MVC applicatio ?


 

A controller will decide what to do and what to display in the view. It works as follows:

i) A request will be received by the controller
ii) Basing on the request parameters, it will

Read more...
Submitted by:P.R.S
11/4/2012 12:00:00 AM
Language: Asp.net MVC

1.Put this in .aspx

<%@ Import Namespace=" System.Net.NetworkInformation"%> above

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "ht

Read more...
Submitted by:P R S
9/19/2012 12:00:00 AM
Language: Asp/Asp.net

1. 1) Go to Start >> All Programs >> Microsoft visual studio 2008 >> Visual Studio Tools >> Visual Studio 2008 Command Prompt (Note: if you’re using windows 7 right click on command prompt and select Run as administrator)
 
2. 2) after op

Read more...
Submitted by:P.R.S
7/31/2012 12:00:00 AM
Language: C#

 

Sending email from a web page is one of the most common functionality required from a web site. 

The System.Web.Mail Namespace in the .NET Framework contains the required support classes and enumerations for email capabilities.

The main classes used are System.Web.Mail.MailMessage and the SmtpMail class.  contains the listing for a simple web form to send email. This form assumes that the SMTP service is running on the serve

 

Step 1  Add Code in .cs File

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.Mail;
using System.Net.Mail;
using System.Net.NetworkInformation;
using System.Net;
using System.Net.Mime;
public partial class enquiry : System.Web.UI.Page
{
    protected void Page_Load(obj

Read more...
Submitted by:santosh
7/30/2012 12:00:00 AM
Language: PHP

 

$file_name = $_FILES['uploadFile']['name'];
<

Read more...
<<Priv    Next>>

Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Sponsor