Thursday, 5 March 2015
showing viewdata in MVC 5 on razor view
Saturday, 28 February 2015
read json in c#
how to read class property name in c#
Saturday, 20 December 2014
Thursday, 18 December 2014
Convert number to words c# code
Friday, 12 December 2014
stylecop visual studio
A simple design page : When inserting the Name checking the text value
Setting of Style Cop Rules and Properties
Rule Selection
a) Click on the check box to check or uncheck the rules to apply for code analysis, By default it is checked for all rules
Company Information
Run the style Cop to check the code analysis
Either from Toolsà Run the Style Cop
Or Right click on project explorer à Run the Style Cop
When you run it it will give the Warnings if it will break the rules.
On Running the Style Cop
Output Code snippet
After rectifying all the warning by Style cop getting result Violation count : 0
Exclude the Particular File from Style Cope
Creating Custom Rule
Steps to Creating Custom rule
1> Creating One Class Library file
2> Import the two DLL and reference it to project
using Microsoft.StyleCop.CSharp;
using Microsoft.StyleCop;
From C:\Program Files\Microsoft StyleCop 4.4.0.14
3> Add one XML File for configuration
4> Successfully Build the code in Release mode
5> Place the DLL into
C:\Program Files\Microsoft StyleCop 4.4.0.14
Code Snippet for Custom Rule to Check Data Base is Closed or Not “.CS file”
XML Code Snippet
Get the Custom Style Cop Rule into project
Custom Warning
Tuesday, 9 December 2014
Friday, 28 November 2014
vs2013 New Features
Feedback & Notifications
In VS2013 product we can provide the feedback about the product
There it provided different options and you can Report to the Bug to Microsoft directly also
You can see the latest updates on product by seeing the notification from clicking the icon. It will give the count of notification on flag icon just beside of quick launch.
Code Lens
This is wonderful features introduce by VS2013, by using it you can see the references of particular method, Constructor and Class in your application in one instance.
Just keep the mouse over there it will give you the information of all the references and for more detail you can click so it will redirect to that piece of code or just put the mouse so it will show you the code.
Peek Definition
In Previous version of Visual studio, to get the definition of any function we need to do F12 and it will redirect to respective method. Now with the feature of F12 Microsoft introduce feature of Alt + F12. It will open a window in same page, which have function definition.
Just do Alt + F12 or Right click on Method.
You will get the peek definition as below; Than page will open which the piece of belongs to
Code Preview Scroll Bar
You can customize the Scroll bar for your code preview and it improve the functionality of viewing the code.
Scroll will be look like a narrow code window and on doing the mouse over to the scroll it will be look like the left screen.
CodeMap – On Debugging (flow chart Display)
It helps to analysis the flow of the code at time of debugging.
Code map Icon will be visible at the time of debugging and when you click on it, it will open the Call stack.
On Right side window will be open which is having the Call stacks with the list of method that pass and list of method will come. It shows the list of debug point in the methods and where exctly we are also.
New Blue Theme
Microsoft Introduces theme in VS2012, Now they increase the collection of themes and introduce the blue theme.
You can choose the themes from Options à General
Blue theme will look like vs2010 IDE
Navigate To By Ctrl+,
Using the new Navigate To, smart semantic search will open and there you can type the method name or Class name it will open in the list with the search;
Just Type the ctrl + , and search you are looking for and by clicking on search result it navigate to search result.
Enhanced Scrollbar
Enhanced Scrollbar provides the vertical scrollbar a visual cues.
It mark the scroll bar with Quick view for debug point, Unsaved Value, Error, Current Position and Search result.
It brings the information into finger tips and when you click on that mark it open that piece of code where the mark belongs to.
Auto Brace Complete
Auto Brace is the power tool feature introduces in vs2013, As pet it parenthesis, Braces and Quotes will automatically
added for you when you open it.
Move Line Up/ Down
One another feature for power tool, you can move up or down the selected piece of code by using alt + arrow up and
down by alt + arrow Down
Monday, 10 November 2014
sequence of events in master page and content page
Problem: Why its required?
Many time its happen that you need the value of master page into Child page or the user control page into Webpage. Then from below description you will know that what is the possibility.
Creating the three file in application.
1. Site1,Master
2. WebForm1,aspx
3. WebUserControl1.aspx