Monday, September 30, 2013

Event handler generation in Visual Studio 2012

There are lots of new features there in visual studio 2012. Event handler generation is one of them. In earlier version of visual studio there was no way to create event handler from source view directly.  Now visual studio 2012 have event handler generation functionality.

So if you are editing an event view in source view intellisense will display add new event handler template and once you click on it. It will create a new event handler in the cs file. It will also put a eventhandler name against event name so you don’t need to write that.

So, let’s take a simple example of button click event so once I write onclick attribute their smart intellisense will pop up
.
Event handler generation in visual studio 2012 - What's new in visual studio 2012

Now once you click on <Create New Event> It will create event handler in .cs file like following.


Event Handler in asp.net with visual studio 2012 - What's new in visual studio 2012

It will also put submitButton_Click on onClick attribute. 

Create event new handler in visual studio 2012 - new feature of visual studio 2012

Go to definition in JavaScript feature of Visual Studio

In recent days I am exploring the Visual studio features and this blog post is also part of that. I am loving visual studio 2011 beta more and more after exploring features that make developer’s life easy. Today I am going to talk about one of the features that is going to make developer’s life easy. 

JavaScript is a client scripting language which is an integral part of any web application now days.  So if you are web application developer you are surely going to write lots of JavaScript those days.  With earlier version of visual studio navigating code in JavaScript is not easy. But in visual studio 2011 beta we have go to definition features which one of most favourite features of visual studio for visual C#.


Here is the screen shot for that. I am navigating in JavaScript code in ASP.NET MVC 4 application.

Javascript Goto definition featuers in visual studio 2011 beta features series

That’s it hope you liked it. Stay tuned for more updates. Till than happy programming!!!.

Page inspector in Visual Studio 2012

What is Page Inspector:

Page inspector is a great tool to inspect your page in Visual Studio itself. In other words, You can use Page Inspector as a browser and inspect your pages in Visual Studio itself. It’s really slow a common problem you can diagnose your page in visual studio itself. You can see where you UI comes from and even you can look into your page in HTML.


PageInspectorinVisualStudio2012

You can also directly run page via right click project like following.

PageInsepctorLoadinVisualStudio2012

Once you load Page Inspector it will load you web application in Visual Studio.

File loading in Page instpector Visual Studio 2012

Features in Page Inspector:

Page inspector provide lots of features.

Inspecting HTML with Page Inspector:

You can inspect your HTML will page inspector and you can see what is there in HTML of your page. For example, I have clicked on about page and you can see that in HTML code.

Inspect HTML with Page inspector in Visual Studio 2012

Inspect CSS and fix issues with CSS:

You also inspect your CSS and fix issues with css. Like following.

CSSinPageInspectorVisualStudio2012

Here I have selected Aside and you can H3 tag with that

Dependency graph in visual studio 2012- Understand your code better.



What is Dependency Graph?
Dependency graph help you visualize how your code is written and organized and provide view on code dependencies. This is very useful when you are working with a code that you have not written. With the dependency graph you can easily get an idea of code written by others in a application.

How to create Dependency Graph:

You can easily create dependency graph via architecture menu –>Generate Dependency graph. You will also presented to two options like below.
  1. For Solution
  2. For Include file.
HowtoCreateDepencyGraph

I have created a basic web form application and created a dependency graph for entire solution like below.

DepecnyGraphWithWebapplicationVisualStudio2012

Here you can see, I have created a blank template dependency graph and its showing me all reference and class that it has included.

There are multiple options provide to create graphs and filter graphs like Assembly,Namespace, Interface, Struct, Enumeration, Delegate etc. Once you click on any block it will provide relationship with other block like following.

RealtionShipWithDependencyGraph

There is a option available in solution explorer to create a graph for particular file(s). Like following.

SolutionExplorerDependencyGraph

and once you click new dependency graph it create graph like following.

GraphCreatedFromVisualStudioSolutionExplorer




Synchronized settings with live account Visual Studio 2013.

In the earlier versions of Visual Studio, To import settings and export setting we have to import and export setting manually. There is no way it will directly set the setting with all the Microsoft Visual Studio PC’s. But now with Visual Studio 2013 Synchronized settings feature you can sync all the settings with your live account. So if you have applied one settings one computer and you want to apply the settings in another computer you don’t have to worry about it. Let’s see how its works.

Visual Studio 2013 Live Account:





After installing once you start Visual Studio 2013 It will ask you to login into live account.



Once you logged into that account it will load visual studio.



On the right hand corner you can see your name and it will sync your account setting with that live account. Once you click on ‘Account settings’. It will load the settings page.


Synchronized settings options:

In Tools-> Option Menu there is a setting for Synchronized settings where you enable synchronization for different categories like appearance settings, Environment Aliases,Keyboard shortcut, Start Up and Text Editor.

VisuaStudioSynchronizedSettingsOptions

So, Now you have a simple way to maintain your settings across all your development machines where you have visual studio. It’s very helpful for developers like me where we have tons of personalized settings for visual studio and every time I change some thing or change a shortcut it was difficult to maintain.  That’s it. Hope you like it. Stay tuned for more..

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...