Sunday, March 11, 2012

dropdownextender and checkboxlist

I also have this problem. When a treeview is inside the panel exposed, you can only select one node, then the panel closes. I would like it to stay open and allow the selection of more than one node in the tree that drops down.

As I still do not know how to do this, we need some way to call the dde server side when the nodes collapse.

If we can call show on the dropdownextender, like you can for the popupcontrol, we could catch the events below server side and show the panel again.

ProtectedSub ClassificationTree_TreeNodeCollapsed(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.TreeNodeEventArgs)

DDE1.Show() 'as an example

EndSub

ProtectedSub ClassificationTree_TreeNodeExpanded(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.TreeNodeEventArgs)

DDE1.Show()

EndSub


As a workaround.. This code mimicks the dropdown (kind of) and allows you to simulate the extender for a treeview, so that when you expand and collapse the nodes the popup stays put.

You will need the two images that look like the dropdown image.

<asp:ImageButton ID="imgClassify" onmouseover="this.src='images/dropdownarrow.png';" runat="server" onmouseout="this.src='images/dropdownarrow2.png';" ImageUrl="~/images/dropdownarrow2.png" CausesValidation="False" OnClientClick="javascript:return false;" ToolTip="Click to change the classification." />


<asp:Panel ID="PopUpClassifyPanel" CssClass="ContextMenuPanel" style="display: none;" runat="server" BackColor="#FAFAFA" ScrollBars="Auto" BorderStyle="Inset">

<table border="0" cellpadding ="0" cellspacing ="0">
<tr>
<td style="width:30px; ">
</td>
<td>
<asp:TreeView Width="300px" ID="ClassificationTree" runat="server" ToolTip="Select a new Industry, Sector and Sectorid." EnableClientScript="False" EnableTheming="False" ForeColor="#003399">
</asp:TreeView>
</td>
</tr>
</table>

</asp:Panel>
<cc1:PopupControlExtender ID="PopupControlExtender3" PopupControlID ="PopUpClassifyPanel" Position ="bottom" runat="server" TargetControlID="imgClassify">
</cc1:PopupControlExtender>

ProtectedSub ClassificationTree_SelectedNodeChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles ClassificationTree.SelectedNodeChanged

PopupControlExtender3.Cancel()

....

EndSub

No comments:

Post a Comment