Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to trace

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

Suggested Solutions

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

840 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