TechBubbles

Calling ASP.NET AJAX Modal Window from JavaScript

 

This post discusses about calling AJAX model window from JavaScript. The scenario is checking the UI controls in page and alerting the user if he is leaving the page without saving the data. This shows confirmation window with yes and no buttons.

The Form body code looks as below

   1: <body id="Body">

   2:     <form name="Form" method="post" runat="server">

   3:     <asp:ScriptManager ID="mgr1" runat="server"></asp:ScriptManager>

   4:     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

   5:     <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

   6:     <asp:DropDownList ID="DropDownList1" runat="server">

   7:         <asp:ListItem Value="no" Selected="True">NO</asp:ListItem>

   8:         <asp:ListItem Value="yes">YEs</asp:ListItem>

   9:     </asp:DropDownList>

  10:  

  11:     <asp:Button ID="Button1" runat="server" Text="Button" 

  12:      OnClientClick="javascript:return UnSaved();" />

  13:  

  14:     <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" 

  15:            runat="server" TargetControlID="btnHid"

  16:         PopupControlID="pnlSave" BackgroundCssClass="modalBackground"

  17:           CancelControlID="btnCancel"

  18:         PopupDragHandleControlID="panEdit">

  19:     </ajaxToolkit:ModalPopupExtender>

  20:     <asp:Button runat="server" ID="Button3" Style="display: none;" />


  21:     <asp:Panel ID="pnlSave" runat="server" BorderColor="Black" 

                   BorderWidth="3px" 

  22:          Height="100px" Width="180px">

  23:         <table width="100%">

  24:             <tr>

  25:                 <td >

  26:                     Do You want to save data?

  27:                 </td>

  28:             </tr>

  29:         </table>

  30:         <br />

  31:         <asp:Button ID="Button2" runat="server" Text="Save" />

  32:         <asp:Button ID="btnCancel" runat="server" Text="No" />

  33:     </asp:Panel>

  34:     <asp:Button runat="server" ID="btnHid" Style="display: none;" />

  35:     </form>

  36: </body>

Read more

Related Posts:

No comments

Optimizing the website Performance using ASP.NET 4.5

 

There are so many different ways you can optimize your website performance. You may think why we need to worry about website performance when internet connection speed is growing faster and faster. Just few examples: Google did a test, if their search page is 500ms slower then they are going to lose 20% their traffic. If Amazon runs 100ms slower then there is 1% drop in their sales which is nearly $1 million a day. So it is important build the website which are fast in response time. ASPNET_vNext

Typical website may have the following architecture. We can do optimization in each layer but this post specifically talks about ASP.NET 4.5/IIS which is a presentation layer.

image

Read more

Related Posts:

2 comments

Creating Data-driven web apps using ASP.NET 4.5 Web Forms

 

Data binding is simpler and more powerful in ASP.NET 4.5 Web Forms.This post discuss about creating Data-driven application using ASP.NET 4.5 preview. It also discuss about different Data access methods, particularly about model access binding features in Web Forms. You need to install Visual Studio 11 Developer preview to use this feature. You can read this post for links to download etc.. ASPNET_vNext

Typical ASP.NET developer may use one of the following Data Access mechanisms for binding the data

  • You may setup your Database First – Creating a Schema and generating model from it. Here model is a class which you are going to interact with your database from your code.
  • You may setup your Model First – Instead of designing the database first, we design the entity model first eg: using entity framework. Design your model first and then generate a schema and code.
  • You may setup your Code First- In this approach you first write code to design the model and then generate a schema using that code.

Read more

Related Posts:

1 comment

Web Standards Update for Visual Studio 2010 Editor

 

Web Standards Update for Visual Studio 2010 SP1, which provides HTML5 and CSS3 support. Microsoft team said Visual Studio next version have better support for HTML5. This update gives you HTML5 Intellisense and fixes some bugs in SP1 support for HTML5. CSS3 intellisense on latest specification from W3C. vshtml5

Download Web Standards Update for Visual Studio 2010 Editor

Please note this is not an official release from Microsoft.

HTML 5 Features support in this update

Complete Valid Markup -

We need a type attribute in script tag in SP1. It throws a validation error if you miss the attribute. Now you do not need to put this attribute. New items in the type list like text/x-jquery-tmpl

image

Read more

Related Posts:

1 comment

Deploying Database with ASP.NET Web application

 

Web applications can be deployed in two different ways one by using one-click publish or by using a Web deployment package. Usually we may want to deploy our database scripts that we used along with the application deployment. This post discusses the procedures to deploy the database along with web application in Visual Studio 2010.

Assume there is no database exist in destination and configure the below steps for first-time database deployment

Read more

Related Posts:

1 comment

Web.Config Transforms in Visual Studio 2010

 

This post discuss about using Web.Config Transformations in Visual Studio 2010. It is a new feature in Visual Studio 2010.

You have a very simple web.config file as shown below. In this Config file we have a very simple connection string for NorthwindDatabase. It is pointing to the local SQL Server Express instance.

image

Read more

Related Posts:

No comments

Dynamic Metadata using ASP.NET 4.0

This post explains about Dynamically assigning Metadata to a page using code behind in ASP.NET 4.0. Metadata is so important as Search engine optimization considers Metadata keywords and description to index  the page. If you can dynamically assign the metadata to your page then search engine can easily analyze and puts the page in results list.

1. Create a ASP.NET web application in VS 2010 and add a grid view to the page

image 

Read more

Related Posts:

No comments

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

Next Page »