Mysteric
Mysteric

Reputation: 106

How to see the data of a variable?

How can I see the data of a variable in asp mvc 2 like shown in the picture on this site?

http://www.joe-stevens.com/2010/02/17/asp-net-mvc-using-controller-updatemodel-when-using-a-viewmodel/

the one where he is viewing the data of the FormCollection

Upvotes: 1

Views: 122

Answers (3)

Colin Pickard
Colin Pickard

Reputation: 46663

Assuming you're using Visual Studio, you need debugging mode. Click to the left of the code on the line where you want to inspect the variable, you should see a red circle for the the breakpoint. The press F5 to enter debugging mode, and do whatever operation calls that code in your app. Visual Studio will stop and highlight the line when you reach it, at which point you can just hover your mouse over the variable to get the effect you see in that screenshot.

You can read a lot more about debugging in Visual Studio here:

http://msdn.microsoft.com/en-us/library/sc65sadd.aspx

Upvotes: 0

Adam Flanagan
Adam Flanagan

Reputation: 3052

This page has a good introduction to debugging with visual studio.

Upvotes: 0

Dmitry S.
Dmitry S.

Reputation: 8513

You need to set a debugger break point on the code line by double clicking on the left margin next the code line in the Visual Studio. Make sure the compilation element in the Web.Config file has a debug="true" attribute (see below). Then click F5 to run the application.

<system.web><compilation debug="true">...</compilation><system.web> 

When you perform an operation that calls that code, the debugger will stop at the break point. You will be able to hover the mouse cursor over the variable and see the data.

Upvotes: 1

Related Questions