Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Closing the DropDownExtender's Panel manually

Reply
Thread Tools

Closing the DropDownExtender's Panel manually

 
 
Abbas
Guest
Posts: n/a
 
      07-26-2007
Hi,

I have a nested DIV structure where both have an onclick event, hence
I am cancelling the event from bubbling up to the outer DIV, but this
has caused the Panel to remain opened when I click on another dropdown
(in another item within my repeater) or anywhere else on the page, and
I am wondering if anyone knows how to close the panel manually using
the AjaxControlToolkit.DropDownBehavior?

Here is some source code:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%# Eval("Text") %>
<div id="test<%=counter++ %>" onclick="cancelEvent(event)";>
<asp:Label ID="TextLabel" runat="server" Text="Select your
favorite exotic ice-cream flavor"
Style="display: block; width: 300px; padding:2px; padding-
right: 50px; font-family: Tahoma; font-size: 11px;" />
<aspanel ID="DropPanel" runat="server"
CssClass="ContextMenuPanel" Style="display :none; visibility:
hidden;">
<asp:LinkButton CommandArgument="www.google.ca"
runat="server" ID="Option1" Text="Mocha Blast"
CssClass="ContextMenuItem" OnClick="OnSelect"/>
<asp:LinkButton CommandArgument="www.google.ca"
runat="server" ID="Option2" Text="Java Cyclone"
CssClass="ContextMenuItem" OnClick="OnSelect" />
<asp:LinkButton CommandArgument="http://www.google.ca"
runat="server" ID="Option3" Text="Dry Fruit"
CssClass="ContextMenuItem" OnClick="OnSelect" />
<asp:HyperLink ID="HyperLink1" runat="server"
Text="HyperLink" NavigateUrl="http://www.google.ca"
CssClass="ContextMenuItem" />
</aspanel>
<ajaxToolkitropDownExtender runat="server" ID="DDE"
TargetControlID="TextLabel"
DropDownControlID="DropPanel" /></div>
<br />
<asp:UpdatePanel id="Update" runat="server">
<ContentTemplate>
<asp:Label id="lblSelection" runat="server"
Style="padding: 5px;" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Option1"
EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Option2"
EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Option3"
EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</ItemTemplate>
</Repeater>


The JavaScript:

function cancelEvent(e) {
//var test =
AjaxControlToolkit.DropDownBehavior.get_isOpen();

//src.onclick();
alert('cancel');
if(window.event) {
alert('1');
if (!e) e = window.event;
e.cancelBubble = true;
}
else if ( e.stopPropagation) {
// alert('2');
e.stopPropagation();
}
else {
alert('3');
return false;
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to detect closing of wx.Panel? Jacol Python 2 02-19-2007 06:31 PM
Closing popup window when closing parent window? =?Utf-8?B?Vk1J?= ASP .Net 3 02-15-2007 08:29 AM
Closing the doors 15 minutes before closing. doofus Computer Support 12 06-11-2005 08:20 AM
manually closing DB connections...required? darrel ASP .Net 7 10-15-2004 03:22 PM
Closing child window WITHOUT closing parent thomas Javascript 0 10-23-2003 04:10 PM



Advertisments