A unique concept behind this particular div is that it contains a quote from a customer fetched from the server by means of a random function call. Every few seconds, a jQuery script runs to smoothly fade out the current quote and display another one in its place.
The following code snippet represents my Div implementation in my .ascx file:
<div class="testimonial" ID="Fader" onload="runTestimonial">
<q>"<asp:Literal runat="server" ID="Quote"></asp:Literal>"</q>
</div>
Code Behind (.ascx.cs):
protected void runTestimonial(object sender, EventArgs e)
{ --lots 'o code--
Partnership partnership = Partnership.GetRandomTestimonial(cmPage.CMPageId);
if (partnership != null)
{
Quote.Text = partnership.Testimonial;
Visible = true;
}
}
Utilizing the following jQuery code:
setInterval(
(function () {
$('#Fader').fadeOut('slow', function () {
setTimeout(function () { $('#Fader').load().fadeIn('slow'); }, 300);
});
})
, (200))
The jQuery functionality appears to be properly set up as it interacts with the div's Fader ID to manage the fading and loading effect.
In the past, the div would fetch the quote using a Page_Load method of similar structure which worked seamlessly. The recent modification requires the retrieval to occur not on initial page load, but with the help of jQuery refresh events.
Currently, the div fades in and out as intended, however, it displays as blank indicating an issue with rendering the ASP content. Executing the runTestimonial function seems to be the problem area, possibly due to an incorrect invocation within the jQuery context.
Struggling with C#, jQuery, ASP, or code-behind procedures? Seeking assistance!