Tuesday, 31 March 2015

How to get Row Index using LINQ in C#?

In this post, Get the row index using LINQ in C# based on column

Ex :

  int rowindex = new System.Data.DataView(datatable).ToTable(false, new[] { "Columname" })
                .Select(row => row.Field<string>("Columname")) .ToList()
                .FindIndex(col => col == variablewithvalue);

Happy Coding:)

How to get count of rows based on column using LINQ in C#?

In this Post, Get count of rows using LINQ in C# based on column.

Ex :
int VenueCount = datatable.AsEnumerable().Count(p => p.Field<string>("columname") == svalue);


svalue is a varaible contain string

Happy Coding:)

How to get Maximum Value using Linq based on Column?

In this post, Get the maximum value using LINQ based on Column in C#.

Ex :
int maxvalue = datatable.AsEnumerable().Max(r => r.Field<string>("Columname"));

Happy Coding:)

How to Get Day name using DateTime in C#

In this post, I am going to tell how to get the day name of selected date using DateTime in C#.

Ex :1
 Get Day Name of Today

Output : Tuesday

Ex 2:

Get Day Name of selected date

1. Add Either days to current date
2. Then add DayOfWeek to that DateTime.Today.AddDays(12).DayOfWeek.ToString()

   Output : Wednesday

Happy Coding:)

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 :)