TechBubbles

WCF Service using ASP.NET AJAX Library

More often, the data to shown in an AJAX page is retrieved from the Web server using a Web service, a Windows Communication Foundation (WCF) service. The services that can also return JavaScriptObjectNotation(JSON) are potential candidates for AJAX pages.

This post explains about calling a WCF service using ASP.NET AJAX Library Data View control. The following are the steps to create and call the service using ASP.NET AJAX Library.

1. Creating a AJAX enabled WCF service

2. Loading the required scripts

3. Calling a service using ASP.NET AJAX Data View Control

Read more

Related Posts:

1 comment

Master-Detail Views using ASP.NET AJAX

Master-Detail Views are very common in data-driven Web pages. These views are used for rendering one-to-many relationships. ASP.NET Web forms provided the strong server controls like grids,lists and drop-down lists which supports the multiple levels of data.

In Master-Detail View we normally navigate among master records and drill down into the details of the records that are of interest. In classic Web forms we need trigger many post-backs which most of the users are not happy these days.

This post explains about building a Master-Detail View using ASP.NER AJAX Library.

The DataView Client control is the fundamental tool for building master-derail views in ASP.NET AJAX and it can be used to generate both Master and Detail views.

Basic steps to build the Master-Detail application using ASP.NET AJAX

1. Create markup for the master and detail views.

2. Attach the DataView control to each view.

3. Use data-binding expressions to populate the data to the controls.

Read more

Related Posts:

No comments

ASP.NET Application Architecture Steps

Introduction

If you have good logical skills and aptitude then it can be easier for learning programming languages. Unlike programming Software Architecture requires years of experience to master. Software Architecture is a guide to shape your project and Architecture of a system is nowhere related to the code that you write for this system. This post explains the architectural steps involved in application development.

Software Architecture is simply blueprint of your application. Software Architecture is closely related to the business needs of the project and it is not concerned about technology on which the project built upon.

Software Design deals with the implementation of the architecture which includes what design patterns to use to make the application scalable, what development methodology that we use in development phase. Basics about software architecture can be found here.

Business Requirements

Assume the following are the high-level specifications of the requirements

· System should be accessible from any location.

· System should be able to process multiple tasks.

· System should be able to process information from different databases.

· System should interact with other software packages.

Software Architecture Specification

Architecture specification for the above requirement

  • The system should be web based
  • The system should have built-in multithreading capabilities.
  • The system should be database-independent.
  • The system should expose APIs to import and export data from other sources.

Software Design Specification

Choosing a design pattern- Design patterns are proven solutions to the business problems. It tells us how we can achieve a solution in-terms of implementation.

We will need to customize the design-patterns to meet your unique needs.

Use Case Design: Creating use-case document which explains the interaction between the application and the end user. It lists the interaction steps sequentially. Each use-case should capture a specific scenario from end-to-end.

Prototyping

For Web projects, designing a working prototype in HTML before starting to work on developing is really helpful. Properly-Linked HTML pages with some dummy data shows the important business process flows and answers the business-related questions. It is highly recommended to develop a prototype before the actual coding for a project.

Class Model

The Architect and Technical lead will create an object model of the system which specifies important entities in the system and how they will interact.

Database Model

A database model would be created based on the class model described above. The use-cases, class model and database model will help the development team with clear instructions. Based on this project manager will highlight the milestones of the development phase.

Development-Phase

Identify and Separate the different components in the application. This separation can be at two levels

  • Physical Separation: We separate code physically into different assemblies. Each assembly or component can be deployed to servers across the geographical locations. We also call this as n-tier architecture.
  • Logical Separation: Separating the code logically into different layers, but the entire application will be part of a single assembly and can be deployed to single server. Unlike physical or tier architecture it is not possible to deploy parts of the application in a distributed manner.

Programming the layers

  • Web forms as the presentation layer

-Usually contains the graphical display components like ASPX pages,

Master pages and style sheets.

  • C# or VB code for handling the business logic as the Business Logic Layer (BLL).

-Usually contains business rules and presents the data to presentation layer. This layer may also include code for error handling and logging.

  • Data Access code as the Data Access Layer (DAL).

- This layer is a set of classes used to encapsulate data access methods. DAL’s primary job is to communicate with the database and pass it to the business logic layer.

Conclusion

This post examined the difference between tiers and layers and the different  ways we can structure our project using tiers and/or layers in ASP.NET application.

Related Posts:

No comments

Client IDs in ASP.NET 4.0

This post explains about setting the client ids in ASP.NET 4.0. Knowing the id attribute of the control rendered on page is a long-standing issue. It is important to know the id if we want to use it in script libraries. The new property ClientIdMode Addresses this issue.

                                    image-thumb

Read more

Related Posts:

2 comments

ASP.NET Error Handling

This article explains about adding error handling capabilities to the ASP.NET Web application. It also explores the possible ways to handle and log the errors that occur in the application.

                                             image

There are two types of exceptions that can occur in web application.

Read more

Related Posts:

No comments

Data View Control in ASP.NET AJAX 4 Preview 4

Introduction

The Data View Control in AJAX 4 has some cool features like it can be bind to any JavaScript object or array.It can also be bind to any ASP.NET AJAX Component. You can read the post to know about  ASP.NET AJAX 4.0 Preview 4 features.

Providing Data to the Data View Control

Data can be provided to Data View in a number of ways.

  • Setting the data property of the Data View Control

Example:

 
    <ul sys:attach="dataview" class="sys-template"
        dataview:data="{{ imagesArray }}">
        <li>
            <h3>{{ Name }}</h3>
            <div>{{ Description }}</div>
        </li>
    </ul>

Read more

Related Posts:

1 comment

Using the ASP.NET SiteMapPath Control

Introduction

ASP.NET Navigation controls uses SiteMapPath control to retrieve the navigation information on the website. A SiteMap represent the relationship between the pages in an application. Site Maps Use the Provider Data model. This post explains about default XML Site Map provider, which enables you to store a Site Map in an XML file.

Site Map file contains <siteMpNode> elements. You declare a SiteMapPath control on page and it automatically uses the web.sitemap file located in the root directory.

Add a sitepath control to your we page. You do not need to add to every page in your web site, If you add a SiteMapPath control to a master page then you can display the control automatically on every page.

Read more

Related Posts:

2 comments

ASP.NET Dynamic Compilation

This post explains about ASP.NET Dynamic Compilation and code-behind pages in more details. When you create a ASP.NET page in web site it actually creates a .NET code behind class. The entire contents of the page is compiled into a .NET class.

When you sent a request for ASP.NET page, Framework checks for the corresponding class to the page and if the class not exists, Framework compiles the page into a new .NET class and stores the compiled class in the temporary ASP.NET Folder located at

\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.

In future if request comes to the same page, the page is not compiled again.The previously compiled class is executed and returns to the browser. This process is called ASP.NET Dynamic Compilation.

If the ASP.NET Page is modified corresponding .NET Class is automatically deleted and when new request comes for that page it compiles the modified page into a new .NET Class.

You can even pre-compile your ASP.NET application using aspnet_compiler.exe command line tool. when you pre-compile your application users doesn’t experience the compilation delay for the first request.

  • You can disable dynamic compilation for a single , pages in a folder or for entire web site. Use the CompilationMode attribute in <%page%> directive which allows you to disable the dynamic compilation for a single page.

DC  

  • You can disable dynamic compilation for entire application by specifying CompilationMode attribute in Pages section of the Web.config file.

pages

Disabling the Dynamic Compilation is useful when you have thousands of pages in web site.

Note: You can not disable the  dynamic compilation for pages that include server-side code and pages that contain data binding expressions.

Code-Behind Pages 

ASP.NET Framework allows you create two types of pages. one where you can write page code and declare page controls in a single page. the other way where you can declare UI controls in one page and page code in separate page normally we call this as a code-behind page.

code-behind page work in a different way in ASP.NET 2.0 compared to ASP.NET 1.1. In version 1.1 pages are related by inheritance and in version 2.0 pages are related by inheritance and partial classes.

The problem with the version 1.1 method is any control that you declared in ASP.NET Page needs to be declared in the code-behind file and with exactly same control-ID.

In Version 2.0 the association of ASP.NET Page and Code-Behind page no longer related by inheritance but through a new concept partial classes. It enables you to declare a class in more than one physical-file. Any members of one partial class is accessible to the any other partial class of the same class.

The advantage of using partial classes is declaring a control in ASP.NET Page is available in code-behind page and anything declared in code-behind file will automatically available in Page.

Related Posts:

2 comments

CRUD operations using the List View Web Server Control

Introduction

Using the ASP.NET ListView Control we can insert,edit, or delete records without writing any code. This post explains how to display and update data using the ListView control. We will use SqlDataSource control to retrieve results from the data source and act as the data source for the ListView control.

1. Create a web site in visual studio 2008 by selecting the File menu, click new

    web site option the following dialogue box will appear

 website

2. Enter the name for the web site and say ok.

3. To display and modify the data in listview control add the database file to the

    App_Data folder. Here i am adding the Department table of AdventureWorks

    database.

4. Open the design view of the default.aspx file and add the Listview control

    from the datasection in the toolbox.

Read more

Related Posts:

2 comments

Creating Action Filters in ASP.NET MVC Applications

Introduction

ASP.NET MVC Applications contains the action methods in the controllers. These actions are mapped through the routing when a user makes a browser request. In order to execute your logic before a action method is called or after an action method runs. ASP.NET MVC support this requirement through a concept called ActionFilters. 

ActionFilter Uses

    • Authentication and Authorization can be implemented using action filters.
    • User actions can be logged.
    • For setting up the Localization feature in the application.
    • For Changing the Application behavior based on browser user agent.

Creating an ActionFilter in ASP.NET MVC Application

You can write a ActionFilter class by inherting from ActionFileAttribute class. You can override the method OnActionExecuting and write the logic that executes before Action Method.

  1. To Add a ActionFilter to the ASP.NET MVC Application right click the Controllers folder in the project and select the add new item option and add the class template write the following code.

ActionFilter

 

2.   Applying Filtering attribute to the action method in the controller class

 

Action2

You can also apply the ActionFilter to all action methods in the controller.

Related Posts:

1 comment

« Previous PageNext Page »