Infolink

 

Search This Blog

Showing posts with label Tutorials. Show all posts
Showing posts with label Tutorials. Show all posts

Nov 18, 2012

A simple ASP.NET MVC example to demonstrate Model, View and Controller

MVC Tutorial (PART-1)

The Model

Models are the main component of your app, which is usually; what is stored and retrieve from the database, in our app, it will the tweet info and text.

The View

Views are the date in formatted form, delivered to the user. Here it will be the HTML pages.

The Controller

Controllers are the components that respond to all user requests, decide the appropriate response; which might be render a view, redirect to other URI or many other things.

Pros and Cons
 
Pros

It has many pros, but these are the most remarkable:
  • Full control over the HTML, CSS, and JavaScript code, helping you to write clean, standards-compliant markup
  • It's Extensible which means that you can use a default component, or reconfigure it, or even use another component
  • HTTP friendly, it gives you total control over the requests passing between browser and server
  • Testability of MVC makes it simple to unit test the logic that is specific to a page, by testing controller methods
Cons 

It does not really have many cons compared to its pros:
  • The lake of drag and drop component in WebForms, despite that JQuery and other JavaScipt library overcome this problem
  • It's not as easy as WebForms, you should understand the role of each component individually and all of them together.

Nov 8, 2012

IList Generic Interface

IList Generic Interface represents a collection of objects that can be individually accessed by index.

This example demonstrates how to use IList Generic Interface to store data.
IList Generic Interface represents a collection of objects that can be individually accessed by index.
First, you will need to import the System.Collections.Generic namespace.
using System.Collections.Generic;

Oct 16, 2012

Activity logging and Error logging in ASP.NET

There are lots of error logging providers available such as log4Net, AnLogger, etc. they are easy to use as well, but just to keep it simple, I have written my own. I call it "Activity and Error Logger", it stores the data in XML format, request by request and session by session, you can actually create the user behaviour maps if you properly call the activity log at while performing any major operations. It also takes care of the concurrency, two threads will not overwrite each other. It logs the errors on page in try catch block and also at global level, in Application_Error event in global.asax.

Converting an ASP.NET site into a SharePoint site

Introduction

There are a lot of ASP.NET web developers who are moving to SharePoint site creation. This article will explain in detail how an ASP.NET webpage developed in Visual Studio can be converted into a SharePoint site. If there is a requirement for a website created in Visual Studio, just the old fashioned way with the code-behind logic and other layers like Data Access and Business Logic, to be converted into a SharePoint site, and still make it work the same way with the same code-behind, you are in the right place. This article deals with right that.

Scenario

There is an ASP.NET website solution that contains three layers viz. Code-Behind Layer, Business-Logic Layer, and the Data-Access Layer. The website has functionality implemented in all these layers. The Business-Logic and the Data-Access layers are in a different Class Library project. We have to convert this website into a SharePoint site. Also, we want to use the same look and feel of the SharePoint site. So, we have to use the SharePoint master page instead of the one that we are having (we can also use our own master page; just that you have to add some default Place Holders that are required for the SharePoint functionalities). In this article, we are dealing with a website with the same look and feel as a SharePoint site.
Steps Overview

Oct 14, 2012

Creating a UserControl

we will be building a UserControl for displaying information about a community user.
First of all, let's add a UserControl to our project. In your Visual Studio or Visual Web Developer, you should be able to right click on your project and select Add new item.. A dialog will pop up, and you should select the Web User Control from the list of possible things to add. Let's call our UserControl UserInfoBoxControl, with the filename of UserInfoBoxControl.ascx. Make sure that you have checked the checkbox which places code in a separate file, the so-called CodeBehind file.

You should now have a UserInfoBoxControl.ascx and a UserInfoBoxControl.ascx.cs in your project. The first is where we put our markup, and the second is our CodeBehind file. Now, if UserInfoBoxControl.ascx is not already open and selected, do so now. You will see only one line of code, the UserControl declaration. As mentioned, this control will be displaying information about a user, so let's get started adding some markup to do so:

ASP.net Ajax

ASP.net Ajax is Microsoft's free framework for creating Ajax (Asynchronous Javascript and XML) web applications. At its simplest, it lets ASP developers do this - or add Ajax controls to their existing applications - without leaving their familiar drag-and-drop environment, and without having to understand Javascript or asynchronous communication with the host. According to the O'Reilly Network, it protects developers from "the underlying gibberish that makes it [Ajax] all work".
Related Posts Plugin for WordPress, Blogger...