Skip to content

Instantly share code, notes, and snippets.

@dannylloyd
Created August 8, 2013 14:53
Show Gist options
  • Select an option

  • Save dannylloyd/6185294 to your computer and use it in GitHub Desktop.

Select an option

Save dannylloyd/6185294 to your computer and use it in GitHub Desktop.
Formats asp.net trace information into manageable blocks. Use it like this: formatTraceInformation('Trace-Information');. Where the preferedPane is the ID of the table of information you want to see first opened.
function formatTraceInformation(preferedPane) {
var tracer = $('#__asptrace');
var traceContent = $('span.tracecontent');
//$('*', tracer).removeAttr('style');
//Removes style from trace block
//$('*', tracer).remove('style');
if (tracer.length > 0 && $('#tracer_Show').length == 0) {
$('span.tracecontent > table', tracer).each(function (index, element) {
$(element).addClass('trace-table');
$('tr:first', element).addClass('titleHeading');
var headerText = $('th:first b', element).html().replace(/ /g, '-');
//$(element).addClass(headerText);
$(element).attr('id', headerText);
$('tr:first', element).click(function () {
$('tr:not(tr:first)', element).toggle();
});
$('tr:not(tr:first)', element).hide();
});
//Session-State
$('#' + preferedPane + ' tr', tracer).show();
var sessionState = $('#' + preferedPane + '');
//$('*', sessionState).removeAttr('style');
$('#' + preferedPane + '', tracer).prependTo(traceContent);
$(tracer).prepend('<b id="showAll">Show All</b>');
$('#showAll', tracer).click(function () {
$('tr:not(tr.titleHeading)', tracer).toggle();
});
$('#aspnetForm').append('<a href="#" id="tracer_Show" style="text-align:center;">Show Trace Information</a>')
$('#tracer_Show').click(function (event) {
event.preventDefault();
tracer.toggle();
});
//tracer.hide();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment