Friday, 27 March 2015

Jquery UI Dialog Important Points

This post is regarding JQuery UI Dialog,  with this post every one get some basic knowledge on Jquery UI Dialog . And you are in the position  to explain about Jquery UI Dialog. And clarify all 3W's (What,where,When) and 1H(How).

1. What is Jquery Dialog?

     It is a Jquery UI dialog plugin which is similar to ajax modal popup control. We add the dialog code at <script> tag

2. Syntax

3. Pros & cons

   Pros : Nested popup's (i.e., parent-child relationship)

4. Diff b/w Ajax Modalpopup & Jquery Dialog?

   In ajax Modalpopup - Nested popup is not possible

   In Jquery Dialog : It is possible.

5. Important Features

   5.1 : Open dialog in two ways
          5.1.1 :
                $('#<%=pnlId.ClientID %>').dialog('open')
          5.1.2 :  $("#<%=pnlId.ClientID %>").dialog({

   5.2 : Remove existing styles as per our requirement
   Ex :   // Removing and hiding Jquery Dialog classes
                $(".ui-corner-all").removeClass("ui-dialog-titlebar ui-widget-header ui-draggable-handle");
                $('button[title=Close]').removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close");
                // End

   5.3 : Add dialog to form
          open: function (type, data) {
          If not added to form events are not firing
   5.4 : Properties
          5.4.1 : Set resizable either true or false Ex : resizable:false
          5.4.2 : Set draggable either true or false Ex : draggable :false
          5.4.3 : Set width and height and many more.

   5.5 : Close the dialog
            $('#<%=pnlId.ClientID %>').dialog('close');

   5.6 : Destroy the values in popup
         $('#<%=pnlId.ClientID %>').dialog('destroy');

   5.7 : Even Jquery UI Dialog call from Gridview row command event using ScriptManager,ClientScript at code behind.

I hope this article help you to reduce the time for finding Jquery UI Dialog solution.

Happy Coding :)

Wednesday, 28 January 2015

LifeCycle of ASP.NET Web Forms & MVC

ASP.NET Web Forms 

SILVER U is the short cut notation for ASP.NET Web Forms, Expanded each of letter below.

S - START  - Page starts
I - INIT - initialize the page
L- LOAD - Load the page
V - VALIDATE -  Validate the page
E- EVENT HANDLER - Handle all events
R- RENDER - render into HTML view
U- UNLOAD - At last unload the page

LifeCycle of ASP.NET MVC

In MVC, page life cycle is totally different which doesn't contain any events to fire but in MVC, Life cycle between URL request & response which process in below way,
1. URL is requested by browser
2. processed by IIS
3.  through Routing with handlers
4. Controller action called
5. Processed the request
6.  Response the result
7. render into browser.

FYI, below picture is in detailed description page life cycle of MVC.
ASP.NET MVC Life Cycle
Life Cycle of ASP.NET MVC
If you want in detailed description then referred this link ASP.NET MVC Life Cycle. Which is original post.

That's it,
Happy Coding :)

Tuesday, 13 January 2015

ASP.NET 4.0 Features

Listing all Asp.NET 4.0 Features

In all interviews, asking about features which are released in (2.0/3/0/3.5/4/0/4.5) versions. But now i will explain the features only for 4.0 in this post.

Listing all the 4.0 features in category wise below ,

ASP.NET Core Services

1. Refactoring Web.Config

2. Extensible Output Caching

3. Auto-Start Web Applications

4. Permanently Redirecting a Page

5. Session State Compression

6. Expanding the Range of allowable URL's

Extensible Request Validation

1. Object caching and Object Caching Extensibility

2. Extensible HTML, URL and HTTP Header Encoding

3. Performance Monitoring for Individual applications in a single worker process

4. jquery Included  with webforms and MVC

5. Content Delivery Network Support

6. ScriptManager Explicit Scripts

ASP.NET Web Forms

1. Setting Meta Tags with the Page.MetaKeywords and Page.MetaDescription Properties

2. Enabling ViewState for Individual Controls.

3. Support for recently introduced browser and devices

4. A New way to define browser capabilities

5. Routing in ASP.NET 4

6. Setting ClientId's

7. Persisting Row Selection in Data Controls

8. FormView Control Enhancements

9. ListView Control Enhancements

10. Filtering Data with QueryExtender Control.

11. Enhanced support for web standards and accessbility

Project Template Changes

ASP.NET 4 introduced two new templates for both Web Application and WebSite projects.

1.  Empty
2. Non-Empty

In Empty template,similar to web site layout which already having earlier versions except contain web.config file that specified target version of .NET framework

In Non-Empty template, having created many files which are not available in earlier versions. It includes master page,css,html, ajax and member ship related codes For reference to developer how build the application with the structure.

Dynamic Data

1. Enabling Dynamic Data for Individual Data-Bound Controls in Existing Web Applications

2. Declarative DynamicDataManager Control Syntax.

3. Entity Templates.

4. New Field Templates for URLs and E-mail Addresses

5. Creating Links with the DynamicHyperLink Control

6. Support for Inheritance in the Data Model

7. Support for Many-to-Many Relationships (Entity Framework Only)

8. New Attributes to Control Display and Support Enumerations

9. Enhanced Support for Filters

Here, i am not elaborate each feature in detail, if you want to know elaborate each feature  then click on the below link,

That's it,

Happy Coding :)

Difference between Web Application and WebSites?

Most of the developers are confused on Web Application and WebSite options provided in ASP.NET for developing a new site. Even i also confused at initial stage.

Now i will explain some differences between web application & web site with my experience, By this to get some idea when to choose web application and web sites.

Real time example describes about Web Sites and Web Applications

Website - Providing information about sites (i.e., No Interaction by user)

Web Application - Along with information and also user can interactive with operations/functionality provided by site.


Web Application Web Site
Place all code files (.cs/.vb) in application folder structure and its pre-compiled into single dll.
i.e., one dll for all code files
 Place all code files(.cs/.vb) in App_Code folder and compiled into several dlls at runtime.i.e., several dlls for each code file.
Only one progrmming language  Create multi programming language in one website
i.e., one page using c# and another page created using
 Create automatically .csproj/.vbproj files(i.e., Include all files in the project and any references)No .csproj/.vbproj files
Pre-compile the site before deploymentNo need to compile the site before deployment
Only .aspx files need to deploy because pre-compiled dll's contain all details. Here we upload both .aspx and code behind files
If any changes in code need to re-compile the entire site
i.e., build/rebuild/clean the solution
 Upload only updated files instead of entire site.

These are the basic differences between Web Application and Web Site and i hope this will helpful to get an idea.

That's it,

Happy Coding:)

Monday, 29 December 2014

Compare Validator creating at codebehind in c#

Compare Validator is one of the validator control in ASP.NET validators. With this,we can use to compare the controls with the help of operator and type attributes.

Listing all Types of CompareValidator

  • Currency
  • Date
  • Double
  • Integer
  • String

Listing all Operators of CompareValidator

  • DateTypeCheck
  • Equal
  • GreaterThan
  • GreaterThanEqual
  • NotEqual
  • LessThan
  • LessThanEqual

Now we can see the below example code created in code behind and used for validating the fields,

            CompareValidator cmpval = new CompareValidator();
            cmpval.ControlToCompare = FromDate.ClientID;
            cmpval.ControlToValidate = ToDate.ClientID;
            cmpval.Type = ValidationDataType.Date;
            cmpval.Operator = ValidationCompareOperator.GreaterThanEqual;
            cmpval.ForeColor = Color.Red;
            cmpval.Display = ValidatorDisplay.Dynamic;
            cmpval.ErrorMessage = "From Date should be smaller than the To Date";

Adding the above example control to Placeholder

That's it,

Happy Coding:)              

ASP.NET URL Routing to MVC format

This is very useful post because if user want to show the url like in below format then how your going to show the below format using ASP.NET

ASP.NET URL : http://localhost/view.aspx?paramtype&param1=value&param2=value&...

ASP.NET MVC : http://localhost/view?paramtype&param1=value&param2=value&...

In order to achieve the MVC Url format using ASP.NET WebForms existing project then go with URL Routing. For this we need the following namespace,


I am going to tell in step by step manner,

Step 1 : First add the System.Web.Routing namespace to project using Add Reference.

Step 2 : Add the following line in Web.Config file, under 
 <compilation defaultLanguage="c#" debug="true">

<add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />     

Step 3 : Add namespace  System.Web.Routing in Global.asax,cs file

Step 4 :  Call the method RegisterRoutes in Application_Start event

 protected void Application_Start(object sender, EventArgs e)

Step 5 : Create the event and route the MVC format
 private void RegisterRoutes(RouteCollection routes)
                    routes.MapPageRoute("View", "view/{*extrainfo}", "~/view.aspx", true);

Where, 1st Parameter - Name for routing
2nd parameter : Format for MVC
3rd Parameter - actual page.
4th Parameter - Set to true for routing

That's it,

Happy Coding :)          

Jquery important events

Here the below are jquery events which we are using regular basis and i list all the things in one place,So this, we reduce time for you to get the thing for your requirement. I hope this will help you to fix the issues,

- Text controls

$('input:text[id="textboxTheaterContent"]').val() - Reading
$('input:text[id="textDepFrom"]').val(""); - Setting

- Hidden

- Get the text
 $('#ddlType :selected').text()

- Disable the control
 $("#buttonFileUpload").prop("disabled", true);

- Hide/Show the control

- Focus

- Check Numeric