473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Closing the DropDownExtender's Panel manually

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;" />
<asp:Panel 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" />
</asp:Panel>
<ajaxToolkit:DropDownExtender 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;
}
}

Jul 26 '07 #1
0 1982

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fabrizio | last post by:
Hi, There is any chance to insert a control like a text box in a panel choosing the absolute position? When I try to insert a label , the panel positions the control on a locked position. Thanks...
1
by: John | last post by:
I'm trying to use the DrawText() method to draw some very long string text on the Panel with AutoScroll enabled. However, for some unknown reasons, I could not trigger the ScrollBar to show up. ...
9
by: David | last post by:
hello... i want to renove all controls from panel... i use this: foreach (Control c in panel.Controls) panel.Controls.Remove(c); but it's doesn't work... -- not all controls are removed...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: Jacol | last post by:
Hi everybody, I have poblem with detecting closing of wx.Panel by user. How to detect that event? The wx.EVT_CLOSE event concerns wx.Frame class only. Neither Close() nor Destroy() aren't...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
0
by: tirath | last post by:
hi, I am using DropdownExtender control in my code. I have a label whichis my target and a panel in which i add hyperlink control dynamically. This panel opens up when you click on dropdwon...
0
by: Abbas82 | last post by:
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...
2
by: ryuujin | last post by:
Hi, sorry about my english. I need to scroll manually the content of a panel when the user click on a button. The user have to interact with my application by a touch screen monitor and I...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.