This is a migrated thread and some comments may be shown as answers.

RadComboBox closing RadMenu Context

4 Answers 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 06 Apr 2012, 06:04 PM
Hi,

I have a RadComboBox nested inside of a RadContextMenu.  When I select/change an option from the combobox, the combobox selects the item correctly, but then the RadContextMenu disappears as well.  How can I force the RadContextMenu to remain open after this selection?

Thanks for the help.

Steve

4 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 09 Apr 2012, 07:40 AM
Hi Steve,

You can take a look at the attached page where I implemented the scenario that you describe. Give it a try and let me know if this is the desired behavior.

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Steve
Top achievements
Rank 1
answered on 09 Apr 2012, 02:29 PM
Kate,

Thanks for the reply.  I can clearly see how you are trying to accomplish preventing the menu from closing, however it does not seem to work for me.  The only variance I see from your example and my scenario is that I am using a RadContextMenu control, and yours is just the RadMenu control.  I do see the same OnClientItemClosing event though, so not sure what could be going wrong.  Any suggestions?

<telerik:RadContextMenu id="RadContext" runat="server" EnableRoundedCorners="true"
                                    OnClientItemClosing="ClosingContextMenu" EnableShadows="true" Skin="Sunset"
                                    Width="200">
                                    <Items>
                                        <telerik:RadMenuItem runat="server">
                                            <ItemTemplate>
                                                <asp:Table ID="tblContextMenu" runat="server">
                                                    <asp:TableRow>
                                                        <asp:TableCell ColumnSpan="2" HorizontalAlign="Center" Height="20">
                                                            <asp:Label ID="ContextLblTitle" Text="Associate Name" CssClass="ContextTitle" runat="server" />
                                                        </asp:TableCell>
                                                    </asp:TableRow>
                                                    <asp:TableRow>
                                                        <asp:TableCell HorizontalAlign="Right">
                                                            <asp:Label ID="ContextLblHours" Text="Hours" CssClass="ContextLabel" runat="server" />
                                                        </asp:TableCell>
                                                        <asp:TableCell Width="160px">
                                                            <asp:TextBox ID="ContextTxtHours" CssClass="ContextTextBox" runat="server" />
                                                        </asp:TableCell>
                                                    </asp:TableRow>
                                                    <asp:TableRow>
                                                        <asp:TableCell HorizontalAlign="Right">
                                                            <asp:Label ID="ContextLblFunction" Text="Function" CssClass="ContextLabel" runat="server" />
                                                        </asp:TableCell>
                                                        <asp:TableCell>
                                                            <telerik:RadComboBox ID="ContextCmboFunction" runat="server" DataSourceID="SQLFunctions"
                                                                AutoPostBack="false" MaxHeight="100px" DataTextField="FCTN_FULL_DESC" DataValueField="FCTN_CD"
                                                                EmptyMessage="Choose Function" Style="z-index: 8000" EnableItemCaching="true"
                                                                ExpandAnimation-Type="Linear" ExpandAnimation-Duration="200" Skin="Default"
                                                                OnClientDropDownOpening="DropDownOpening" OnClientDropDownClosing="DropDownClosing" />
                                                        </asp:TableCell>
                                                    </asp:TableRow>
                                                    <asp:TableRow>
                                                        <asp:TableCell HorizontalAlign="Right">
                                                            <asp:Label ID="ContextLblEquipment" Text="Equipment" CssClass="ContextLabel" runat="server" />
                                                        </asp:TableCell>
                                                        <asp:TableCell>
                                                            <telerik:RadComboBox ID="ContextCmboEquipment" runat="server" DataSourceID="SQLEquipment"
                                                                AutoPostBack="false" MaxHeight="100px" DataTextField="EQ_DESC" DataValueField="EQ_TYPE_CD"
                                                                EmptyMessage="Choose Equipment" Style="z-index: 8000" EnableItemCaching="true"
                                                                ExpandAnimation-Type="Linear" ExpandAnimation-Duration="200" Skin="Default"
                                                                OnClientDropDownOpening="DropDownOpening" OnClientDropDownClosing="DropDownClosing" />
                                                        </asp:TableCell>
                                                    </asp:TableRow>
                                                    <asp:TableRow>
                                                        <asp:TableCell ColumnSpan="2" HorizontalAlign="Center">
                                                            <asp:Button runat="server" ID="ContextSaveButton" Text="Save" CssClass="StdButton"
                                                                OnClick="ContextSaveButton" />
                                                        </asp:TableCell>
                                                    </asp:TableRow>
                                                </asp:Table>
                                            </ItemTemplate>
                                        </telerik:RadMenuItem>
                                    </Items>
                                </telerik:RadContextMenu>
                                <script type="text/javascript">
                                    var Context_CanClose = true;
                                    function ClosingContextMenu(sender, args) {
                                        args.set_cancel(!Context_CanClose);
                                    }
                                    function DropDownOpening(sender, args) {
                                        Context_CanClose = false;
                                    }
                                    function DropDownClosing(sender, args) {
                                        Context_CanClose = true;
                                    }
                                </script>
0
Accepted
Kate
Telerik team
answered on 12 Apr 2012, 11:51 AM
Hello Steve,

I tested your code and indeed it does not work correctly for the RadContextMenu. I would suggest, however, that you use the client-side OnClientHiding event and attach the below handler. Thus the context menu will close only when you click the button:
<script type="text/javascript">
            var Context_CanClose = true;
            function ClosingContextMenu(sender, args) {
                args.set_cancel(!Context_CanClose);
            }
            function DropDownOpening(sender, args) {
                Context_CanClose = false;
            }
            function DropDownClosing(sender, args) {
                Context_CanClose = false;
            }
                             
        </script>

markup:
<telerik:RadContextMenu ID="RadContext" runat="server" EnableRoundedCorners="true"
            OnClientHiding="ClosingContextMenu" EnableShadows="true" Skin="Sunset" Width="200"> ...

Regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Steve
Top achievements
Rank 1
answered on 12 Apr 2012, 02:18 PM
Kate,

That did it.  Thanks again.

Regards,

Steve
Tags
ComboBox
Asked by
Steve
Top achievements
Rank 1
Answers by
Kate
Telerik team
Steve
Top achievements
Rank 1
Share this question
or