Hi all,
i am playing around with the Menu control and ITemplates and am trying to figure out how to control the events fired within the ITemplate class and having it effect the Menu Item that it is in client side.
What i have is a Menu control with two items using my custom ITemplate. In essence it is a Panel with a small panel within it that i want to be able to click on and have it close the menu item it is in. It will end up being a menu item that can remove itself from the menu.
I have the ITemplate control loading as expected, but i cannot find out how to, on the onclick event of the panel, have the menu remove the parent item from iteself.
suggestions?
Jordan
i am playing around with the Menu control and ITemplates and am trying to figure out how to control the events fired within the ITemplate class and having it effect the Menu Item that it is in client side.
What i have is a Menu control with two items using my custom ITemplate. In essence it is a Panel with a small panel within it that i want to be able to click on and have it close the menu item it is in. It will end up being a menu item that can remove itself from the menu.
| class CaseMenuTemplate : ITemplate |
| { |
| public void InstantiateIn(Control container) |
| { |
| Panel pBase = new Panel(); |
| Panel pHeader = new Panel(); |
| Panel pContent = new Panel(); |
| pBase.CssClass = "MenuPanelBase"; |
| pHeader.CssClass = "MenuPanelHeader"; |
| pContent.CssClass = "MenuPanelContent"; |
| Label lblCase = new Label(); |
| lblCase.ID = "lblCase"; |
| lblCase.Text = "Case:"; |
| lblCase.CssClass = "MenuLabelCase"; |
| pHeader.Controls.Add(lblCase); |
| Label lblCaseNumber = new Label(); |
| lblCaseNumber.ID = "lblCaseNumber"; |
| lblCaseNumber.Text = "1234567890"; |
| lblCaseNumber.CssClass = "MenuLabelCaseNumber"; |
| pHeader.Controls.Add(lblCaseNumber); |
| Button pClose = new Button(); |
| pClose.CssClass = "MenuCloseButton"; |
| pHeader.Controls.Add(pClose); |
| pBase.Attributes.Add("onmouseover", "this.className = 'MenuPanelBaseHover';"); |
| pBase.Attributes.Add("onmouseout", "this.className = 'MenuPanelBase';"); |
| pClose.Attributes.Add("onmouseover", "this.className = 'MenuCloseButtonHover';"); |
| pClose.Attributes.Add("onmouseout", "this.className = 'MenuCloseButton';"); |
| pClose.Attributes.Add("onclick", "deleteItem(this);return false;"); |
| container.Controls.Add(pBase); |
| pBase.Controls.Add(pHeader); |
| pBase.Controls.Add(pContent); |
| } |
I have the ITemplate control loading as expected, but i cannot find out how to, on the onclick event of the panel, have the menu remove the parent item from iteself.
suggestions?
Jordan