.NET Framework 4.5.2 released
The Microsoft .NET Framework 4.5.2 is a highly compatible, in-place update to the Microsoft .NET Framework 4, Microsoft .NET Framework 4.5 and Microsoft .NET Framework 4.5.1. The offline package can be used in situations where the web installer cannot be used due to lack of internet connectivity
You can download the web installer from here instead of this package if you intend to redistribute .NET Framework 4.5.2.
This package installs the following components:
.NET Framework 4.5.2
.NET Framework 4.5.2 Multi-Targeting Pack:Contains the reference assemblies needed to build apps that target the .NET Framework 4.5.2
.NET Framework 4.5.2 Language Packs
.NET Framework 4.5.2 Multi-Targeting Pack Language Packs: Contains the IntelliSense files to display help while building apps that target the .NET Framework 4.5.2 through Visual Studio and third party IDEs.
. In this release few windows controls has been updated.
ComboBox
ToolStripComboBox
ToolStripMenuItem
Cursor
DataGridView
DataGridViewComboBoxColumn
References:-
http://blogs.msdn.com/b/dotnet/archive/2014/05/05/announcing-the-net-framework-4-5-2-release.aspx
How to configure PageListGrid in MVC
This article explains how to implement paging and sorting in MVC using PagedList with Ajax:
PagedList is a library that enables you to easily take an IEnumerable/IQueryable, chop it up into “pages”, and grab a specific “page” by an index. PagedList.Mvc allows you to take that “page” and display a pager control that has links like “Previous”, “Next”, etc.
Configuration for loading Grid with Ajax :-
Install “PagedList.Mvc” via NuGet – that will automatically install “PagedList” as well.
- Make sure you are adding the unobtrusive in the scripts section of the view as below code.
- Create a partial view for Grid which is (UnobtrusiveAjax_Partial) in the below example
- Call PagedListPager method in the view by passing the list of parameters below:-
data(“Names”),Action Name(“Index”),
PageNumber ,
PagedListRenderOptions – EnableUnobtrusiveAjaxReplacing is the option type in ajax based call.
UpdateTargetId (“unobtrusive”)- the ID of the which need to be updated on paging.
OnComplete (“PagedOnComplete”) – The javascript function PagedOnComplete() will be triggered OnComplete of Grid loading.
-
In Controller the action method must have ‘page’ as the first parameter to identify the page number
- Return the partial view if it is AjaxRequest from client. So that the partial view will get return and the partial view will be reloaded.
Release Candidates for ASP.NET MVC 5.1
Attribute Routing
The Attribute Routing will now support the constraints, versioning enabled and header based route section. Many aspects of attribute routes are now customizable via the IDirectRouteProvider interface and RouteProviderAttribute class.
There’s a Web API-based sample here:
(https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/RoutingConstraintsSample/ReadMe.txt)
the concepts are the same as MVC.
Bootstrap support in HTML Helpers
Now, you can pass HTML attributes in Html.EditorFor as an anonymous object. This means you can pass in Bootstrap styles in HtmlHelpers and style the various input elements such as textboxes, dropdownlist etc. with the correct Bootstrap styles.
Support for Enums
Now in ASP.NET MVC 5.1, the Enum type will be supported in Views. The new HTML Helper Html.EnumDropDownListFor() added will generate a dropdown when binding to Enum types. For this you need to declare an Enum as follows:
When you use the EnumDropDownListFor Helper, it will generate the following view when you are creating an Enum. You can see a full sample at:
https://aspnet.codeplex.com/SourceControl/latest#Samples/MVC/EnumSample/
References:-
http://www.asp.net/visual-studio/overview/2013/aspnet-and-web-tools-20132-preview-for-visual-studio-2013-release-notes
http://blogs.msdn.com/b/webdev/archive/2013/12/09/asp-net-and-web-tools-2013-2-preview-for-visual-studio-2013.aspx
ASP.NET MVC Pipeline Overview
Routing
is the first step in ASP.NET MVC pipeline. typically, it is a pattern matching system that matches the incoming request to the registered URL patterns in the Route Table.
The UrlRoutingModule(System.Web.Routing.UrlRoutingModule) is a class which matches an incoming HTTP request to a registered route pattern in the RouteTable(System.Web.Routing.RouteTable).
When ASP.NET MVC application starts at first time, it registers one or more patterns to the RouteTable to tell the routing system what to do with any requests that match these patterns. An application has only one RouteTable and this is setup in the Application_Start event of Global.asax of the application….. more
References:-
Dot net tricks.
Access modifiers in C#
List of Access Modifiers in C#:
Public: When Members of a class are declared as public, then they can be accessed
1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.
4. Within the derived classes of that class available outside the assembly.
5. Outside the class outside the assembly.
Internal: When Members of a class are declared as internal, then they can be accessed
1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.
Protected: When Members of a class are declared as protected, then they can be accessed
1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Within the derived classes of that class available outside the assembly.
Protected internal: When Members of a class are declared as protected internal, then they can be accessed
1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.
4. Within the derived classes of that class available outside the assembly.
Private: Private members of a class are completely restricted and are accessible only within the class in which they are declared.
References:-
http://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx
http://msdn.microsoft.com/en-us/library/ms173121.aspx
Box Model in CSS
The term “Box Model ” is used when we are talking about design and layout .
In CSS, all the HTML contents are considered as boxes
It consists of :-
1. Margin
2. Border
3. Padding
4. Content
Find the reference image below:-
· Margin – Clears area around the border. The margin does not have a background color, it is completely transparent
· Border – Border goes around the padding and content. The border is inherited from the color property of the box
· Padding – Clears an area around the content. The padding is affected by the background color of the box
· Content – The content of the box, which is actual content
· To set the width and height of an element correctly in all browsers, you need to know how the box model works.
Note: When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add the padding, borders and margins.
Example:
The total width of the element in the example below is 200px:
Calculation:
150px (width)
+ 20px (left + right padding)
+ 10px (left + right border)
+ 20px (left + right margin)
= 200px
CodeLens in VisualStudio 2013
CodeLens is a feature that will be available only in Visual Studio Ultimate edition (more on the controversy here), but adds some very useful behavior to the editor. By default, the number of times a property or method is referenced by your code is shown above that property or method. This information can be helpful when changing existing code, since you’ll know if the method is called from many places or just a handful. In larger projects, especially ones where you’re not familiar with the entire codebase, this can be a big time saver. The number of references is shown in a small font above each property or method on your class, as shown in below figure. Clicking on the number of references will show you all of the methods that call it, making it easy to find and navigate to those sections of your code.
CodeLens
CodeLens without TFS integration shows you the number of times a bit of code is referenced.
While not shown here, CodeLens also has some nice Team Foundation Server (TFS) integration. If you’re using TFS, it will allow you to see commit history and unit tests targeting the code in question.
Difference between == and === in javascript
(==) will try to convert the values to the same type before the condition gets evaluated.
ex:-
5==’5′ —-> TRUE
null==undefined —-> TRUE
undefined==undefined —-> TRUE
(===) will not try to convert the values . this operator will check with data type as well.
ex:-
5===’5′ —-> FALSE
null===undefined —-> FALSE
undefined===undefined —-> TRUE