I want to step through some JavaScript in my *.ascx page, which contains, in part:

<script type="text/javascript">
  . . .

  $("#saveData").click(function () {
      alert('you clicked the saveData button');
      var loc = window.location.href;
          type: "POST",
          url: loc + "/SaveEnteredValues",
          data: "{}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (msg) { alert(msg.d); }

...but CDT does not seem to be making that file available for perusal. This is all I see in CDT=>Sources:

enter image description here

Why is it hiding the JavaScript in *.ascx, and how can I view /step through it?

  • 1
    JS in the ascx file will show up in your destination aspx page. Try looking for it in FinAff_demo_Page_Clay.aspx. Alternatively you can put your script file somewhere else and link to it (highly recommended)
    – azium
    Sep 17, 2015 at 22:28
  • Make that an answer, and I'll mark it as such. Sep 17, 2015 at 22:31

1 Answer 1


JavaScript between <script> tags inside an .ascx file will show up in the .aspx page that loads the control.

In your example you'll be able to step through the code by selecting FinAff_demo_Page_Clay.aspx.

I would generally recommend linking to an external JS file though, so that you can do typical stuff like transpile, minify etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.