user1599108
user1599108

Reputation: 33

jQuery not executing because of asp:Panel

I am using the jQuery plug in contentcarousel. It is a good plugin and all but I need the ability to dynamically create a certain number divs according to the user.

To achieve this I am using an <asp:panel> and then running a Literal & foreach in C# to populate the panel. The problem comes in when the <asp:panel> is used.

It seems as if the jQuery plugin can only work if the divs occur in a certain order.

ie.

<div id="ca-container" class="ca-container">
<div class="cawrapper">
<div class="ca-item ca-item-2">
<div class="ca-item-main">

When the panel is used, then the order becomes

<div id="ca-container" class="ca-container">
<div class="cawrapper">
<div id="panelinfo">
<div class="ca-item ca-item-2">
<div class="ca-item-main">

And the plugin stops working. At least I am assuming so due to the fact that the arrows dont show up, none of the buttons work, etc.

Does anyone know if there is a way around this? Maybe a way to "hide" the div that the panel becomes?

Upvotes: 2

Views: 99

Answers (2)

Servy
Servy

Reputation: 203834

It sounds like you want to have a control that acts like a Panel in server side code, but instead of being rendered as a div just plops all of whatever would have been inside of it without adding anything "extra". That's pretty much the definition of an asp:Placeholder. Just use that instead of a Panel.

Upvotes: 2

N. Taylor Mullen
N. Taylor Mullen

Reputation: 18301

Try moving your JQuery code into window.load. I'm assuming you have your jquery in document.ready which will fire the second the dom is ready.

$(window).load(function(){/*Your code*/}

Upvotes: 0

Related Questions