Solved

how to trace

Posted on 2011-03-18
5
276 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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 article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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