1
I have an Asp.Net application that has a menu on a main screen that has 2 links, each to a page.
When I click on the first link and upload the first page, the function $(document).ready()
wheel set and carries all the components I need.
When I click on the second link, analyzing step by step by Firebug, I notice the function $(document).ready()
is not executed. Why ?
This application uses a layout page that is rendered before.
Function $(document).ready()
$(document).ready(function () {
$('#spn').spinit({ min: 1, max: 100, stepInc: 1, pageInc: 10, height: 13, initValue: 95/*,callback: filtraModeloGrafico4*/});
//Carrega o datepicker
jQuery('#_InitialDateValue').datetimepicker( { format: 'd/m/Y H:i' } );
jQuery('#_FinalDateValue').datetimepicker({ format: 'd/m/Y H:i' });
jQuery('#_InitialDateValue2').datetimepicker({ format: 'd/m/Y H:i' });
//Carrega a combo com os dias da semana
$('#idComboTurno').multiselect({
includeSelectAllOption: true,
nonSelectedText: 'Select a week day',
nSelectedText: 'days',
numberDisplayed: 0
});
});
The name of the file that has the function $(document).ready()
is site.js
Page that loads all right:
@{
ViewBag.Title = "Sequence Inspection - Graphics Report";
}
@Scripts.Render("~/Scripts/site.js")
<div class="row-fluid">
<form class="form-inline">
<div class="control-group span12">
// Código...
</div>
</form>
</div>
Page that does not load Function $(document).ready()
@{
ViewBag.Title = "Sequence Inspection - Failure Report";
}
@Scripts.Render("~/Scripts/site.js")
<div class="row-fluid">
@using (Html.BeginForm("ExportaExcel", "FailureReport", FormMethod.Post, new { @class = "form-inline" }))
{
//Código HTML
}
</div>
Links are loaded by ajax, or are standard browser requests?
– bfavaretto
@bfavaretto, I load the links by the Asp.net helper for example:
<li class="span3">@Html.ActionLink("Graphics Report", "GraphicsReport", "GraphicsReport")</li> <li class="span3">@Html.ActionLink("Failure Report", "FailureReport", "FailureReport")</li>
– Emerson
I will leave to someone who knows ASP.Net respond, I do not know what this helper generates, if it is linked to some js Microsoft, etc.
– bfavaretto
@bfavaretto Displaying the generated page source code we have
<li class="span3"><a href="/GraphicsReport/GraphicsReport">Graphics Report</a></li>
<li class="span3"><a href="/FailureReport/FailureReport">Failure Report</a></li>
– Emerson
I imagined Emerson, but I don’t know if there’s any MVC script intercepting clicks on those links.
– bfavaretto
@bfavaretto The Helper generates a
<form>
in even pure HTML.– Leonel Sanches da Silva