MithunRaj
MithunRaj

Reputation: 103

Debugging javascript in ascx control

I am using javascript for an ascx control in my application. I am getting some errors and want to debug the same.

I have put the debugger in my javascript and unchecked disable script debugging for internet explorer.

When my script is getting executed, I get the debugger launched, and when I attach the javascript (here it is in a separate file ), There is a message as,


There is no source code available for the current location.

What could be going wrong here. I hope to get some tips on debugging javascript with ascx control

Upvotes: 0

Views: 6178

Answers (2)

Ike
Ike

Reputation: 1224

To debug Javacript embedded in a ascx control, you can use chrome explorer.

Here is the step.

  1. Open the page that has the user control in it.
  2. Press F12 on that page.
  3. go to Sources in the "DevTools"
  4. Find pages in the "Sources" tab
  5. click on the page name that you are debugging.
  6. you will see the source code in the middle pane.
  7. your user control javascript is included in the page's source code, this is the key.
  8. use Ctrl + F to find that javascript by the method name you want to debug
  9. add breakpoints to that method and debug

Hope it helps.

Upvotes: 1

gilly3
gilly3

Reputation: 91497

To debug JavaScript, Hit f12 in your browser. This will open the developer tools in most browsers. (with Firefox, this assumes you've already installed firebug, which has to be installed separately as an add-on.)

Select the script tab, set your break points by clicking the margin to the left of the line of code where you want to break. If you are using IE, click "start debugging". Then perform an action on your page that will trigger your code. Happy debugging.

Upvotes: 0

Related Questions