Showing posts with label accordionpane. Show all posts
Showing posts with label accordionpane. Show all posts

Wednesday, March 28, 2012

Linkbutton inside accordionPane header

Hello.

I have an accordion with some panes. In panes header I have a text and a linkbutton. I want to open a pane when user clicks on text, but I don't want to open (or close) the pane when user clicks on linkbutton. When user clicks linkbutton the pane must not move.

Anyone knows how can I do it?

Thanks!!! and sorry for my english (greetings from Spain! :D)


I would also like to know. Looking at the source code I cant seem to find anything short of re-writing in javascript a number of functions.

Rather disappointed with the level of support for these kind of things this control has.


Please someone can help us? :-(


Hi,

The reason and solution has been discussed in this post: http://forums.asp.net/p/1133424/1809338.aspx

Please try it.


I searched before but i didn't find it.

THAT WORKS!!!


THANK YOU A LOT!Cool

linkbuttons in accordionpane header

I am using an accordion that is created dynamically for a menu and have it working as I want - with one exception. When the user clicks on a dynamically created link button on the header, I want to redirect to another page WITHOUT triggering the default action of the accordionpane (expanding or collapsing). Is there any way to accomplish this? Currently, it triggers the default action of the accordionpane (expands or collapses it) then redirects.

Hi,

The expand/collapse action is fired by the <div> element that the header is wrapped in.

When you click in anywhere in the header, it's fired.

When you click on an element in the header, the element's click will be bubbled up to its parent( the header div ) , thus default action is fired too.

So, you can use javascript to prevent the LinkButton to bubble up the event to prevent this from happening.

The following code snippets help to illustrate my idea.

<script type="text/javascript">
function doSomething(e)
{
if (!e) var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
}

</script>

<ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server" HeaderCssClass="myclass">
<Header>
<a href="http://links.10026.com/?link=">1. Accordion</a><asp:LinkButton ID="LinkButton2" runat="server">LinkButton</asp:LinkButton>
</Header>

protected void Page_Load(object sender, EventArgs e)
{
LinkButton2.Attributes.Add("onclick", "doSomething();");

}

Hope this helps.