Solved

how to trace

Posted on 2011-03-18
5
280 Views
Last Modified: 2013-12-17


Hello,

how can I trace an asp code? I'm using VS 2010 and need to trace following code. Is it possible?

Thanks!

<asp:Button ID="btnAddToCart" runat="server" OnCommand="OnCommand" Text="add to cart"
                        CommandName="AddToCart" CommandArgument='<%#Eval("ProductVariantId")%>' CssClass="productvariantaddtocartbutton" />

Open in new window

0
Comment
Question by:akohan
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:SunnyDark
ID: 35169756
You should be able to just put a break point, why that's not an option?
0
 

Author Comment

by:akohan
ID: 35169858

In C# code it shows up when I create a break point but in javascript it doesn't show any thing!


0
 
LVL 1

Expert Comment

by:hank2011
ID: 35169963
you could do a few things in asp enable the tracing for a page writing a trace message using TraceContext.Write or TraceContext.Warn or simply use the breakpoint. There is also a application level tracing.
0
 
LVL 1

Accepted Solution

by:
hank2011 earned 500 total points
ID: 35169971
example in c#

 If (Trace.IsEnabled) {
    For (int i=0; i<ds.Tables["Books"].Rows.Count; i++) {
         Trace.Write("Prod",ds.Tables["Books"].Rows[ i ] [0].ToString());
    }
}
[Visual Basic]
If Trace.IsEnabled Then
    For i=0 To ds.Tables("Books").Rows.Count-1
        Trace.Write("Prod",ds.Tables("Books").Rows( i )(0).ToString())
    Next
End If


or

Context.Trace.Write("My Class","This is a sample trace statement.");
[Visual Basic]
Context.Trace.Write("My Class","This is a sample trace statement.")

or

Trace.Warn("Render", "Text is about to render.");
[Visual Basic]
Trace.Warn("Render", "Text is about to render.")


 
0
 

Author Closing Comment

by:akohan
ID: 35307712
Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question