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

Contextmenu on a radgrid - item click does not fire

1 Answer 212 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jagat
Top achievements
Rank 1
Jagat asked on 30 Dec 2015, 08:02 PM

 

Hi all,

On a radgrid, i want a context menu which has a single item. When i click on that item, it will open another window (modal popup extender) to input some information.

 When i click on the item, it does not go to the event handler. Nothing happens. 

Am i missing anything here?

why does the Radmenu2_itemclick not fire?

Thanks in advance

 

 

 

Grid:

<input type="hidden" id="radgridrowindex" name="radgridrowindex" />
                               <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="Both"
                                   DataKeyName="TripRequestID" OnEditCommand="RadGrid1_EditCommand" CellSpacing="0"
                                   BorderColor="#FF8000" ForeColor="Black" BackColor="SkyBlue" BorderStyle="Double"
                                    EnableHeaderContextMenu = "true"  >
                                   
                                   <MasterTableView>
                                       <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                       <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                       </RowIndicatorColumn>
                                       <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                       </ExpandCollapseColumn>
                                       <Columns>
                                           <telerik:GridButtonColumn CommandName="Select" Text="Edit" ButtonType="PushButton"
                                               UniqueName="column">
                                           </telerik:GridButtonColumn>
                                            
                                           <telerik:GridBoundColumn DataField="TripRequestID" DataType="System.Int32" FilterControlAltText="Filter column1 column"
                                               HeaderText="TripRequestID" UniqueName="TripRequestID">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="TripDate" FilterControlAltText="Filter column2 column"
                                               HeaderText="TripDate" UniqueName="column2">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="PickupTime" FilterControlAltText="Filter column3 column"
                                               HeaderText="PickupTime" UniqueName="column3">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="DropoffTime" FilterControlAltText="Filter column4 column"
                                               HeaderText="DropoffTime" UniqueName="column4">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="Proc_Flag" FilterControlAltText="Filter column5 column"
                                               HeaderText="Processed" UniqueName="column5">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="Start_Desc" FilterControlAltText="Filter column6 column"
                                               HeaderText="Description" UniqueName="column6">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="StartAddress" FilterControlAltText="Filter column7 column"
                                               HeaderText="Start Address" UniqueName="column7">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="Dest_Desc" FilterControlAltText="Filter column8 column"
                                               HeaderText="Description" UniqueName="column8">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="DestAddress" FilterControlAltText="Filter column9 column"
                                               HeaderText="Dest Address" UniqueName="column9">
                                           </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="Persons" FilterControlAltText="Filter column10 column"
                                               HeaderText="Persons" UniqueName="column10">
                                           </telerik:GridBoundColumn>
                                       </Columns>
                                       <EditFormSettings>
                                           <EditColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="EditCommandColumn1">
                                           </EditColumn>
                                       </EditFormSettings>
                                   </MasterTableView>
                                   <HeaderStyle BackColor="DarkOrange" />
                                
                                   <ClientSettings>
                                       <ClientEvents OnRowContextMenu="RowContextMenu"></ClientEvents>
                                   </ClientSettings>
                                   <FilterMenu EnableImageSprites="False">
                                   </FilterMenu>
                               </telerik:RadGrid>
   

 

 

 

 Modal Popup Extender, Contextmenu:

                <asp:Button ID="btnDummyDupTrip" runat="server" Text="Button" Style="display: none" />
<asp:ModalPopupExtender ID="mpuDuplicateTrip" runat="server" TargetControlID="btnDummyDupTrip"
    PopupControlID="panDupTrip" BackgroundCssClass="modalBackground" OkControlID="btnDupCancel">
</asp:ModalPopupExtender>
<asp:Panel ID="panDupTrip" runat="server" CssClass="ModalWindow" Style="display: none">
    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                <tr>
                    <td colspan="2" align="center">
                        <asp:Label ID="lblClientsName" runat="server" CssClass="clntName" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Label ID="lblDupMsg" runat="server" CssClass="lblErrMsg" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="text">Pickup Time: </span>
                    </td>
                    <td>
                         <asp:Label ID="lblPickupTime" runat="server" CssClass="lbl" Text=""></asp:Label>
                        <asp:DropDownList ID="ddlDupPkTime" runat="server" CssClass="ddl">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="text">Pickup At: </span>
                    </td>
                    <td>
                        <asp:Label ID="lblPickupAt" runat="server" CssClass="lbl" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="text">Dropoff Time: </span>
                    </td>
                    <td>
                        <asp:Label ID="lblDropoffTime" runat="server" CssClass="lbl" Text=""></asp:Label>
                        <asp:DropDownList ID="ddlDupDrpTime" runat="server" CssClass="ddl">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="text">Dropoff At: </span>
                    </td>
                    <td>
                        <asp:Label ID="lblDropoffAt" runat="server" CssClass="lbl" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="text">Date: </span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtDupDate" runat="server"></asp:TextBox>
                        <asp:CalendarExtender ID="calDupTrip" runat="server" TargetControlID="txtDupDate">
                        </asp:CalendarExtender>
                        <asp:RequiredFieldValidator ID="reqDupDt" runat="server" ValidationGroup="DupTrip"
                            ControlToValidate="txtDupDate" ErrorMessage="Date is required." ToolTip="Date is required."
                            SetFocusOnError="True">Date is required.</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="text">Route: </span>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlDupRoute" runat="server">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="reqDupRoute" runat="server" ValidationGroup="DupTrip"
                            InitialValue="-1" ControlToValidate="ddlDupRoute" ErrorMessage="Route is required."
                            ToolTip="Route is required." SetFocusOnError="True">Route is required.</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <asp:Button ID="btnDupTrip" runat="server" Text="Duplicate Trip" ValidationGroup="DupTrip" />
                          
                    </td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnDupTrip" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="RadMenu2" EventName="ItemClick" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:Button ID="btnDupCancel" runat="server" Text="Exit" />
</asp:Panel>
 
       
<telerik:RadContextMenu ID="RadMenu2" runat="Server" OnItemClick="RadMenu2_ItemClick">
<Items>
<telerik:RadMenuItem Text="Duplicate This Trip" Value="Duplicate" />
</Items>
 
</telerik:RadContextMenu>

 

Code Behind:

Public Sub RadMenu2_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMenuEventArgs)
    Handles RadMenu2.ItemClick
 
 
    Dim radgridrowindex As Integer
    radgridrowindex = Convert.ToInt32(Request.Form("radgridrowindex"))
    Dim radGridClickedRow As GridDataItem = CType(RadGrid1.Items(radgridrowindex), GridDataItem)
    Dim pickupTime, dropoffTime, pickupAt, dropoffAt, clientsName As String
 
    ViewState("DupTripID") = radGridClickedRow("TripRequestID").Text
    
 
    mpuDuplicateTrip.Show()
 
End Sub

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 01 Jan 2016, 12:21 PM
Hello Jagat,

As you can see in our online demo for displaying a context menu in RadGrid, the server-side OnItemClick event fires correctly:
You could try to remove the UpdatePanel that wraps the RadMenu and see if the event will fire. If so, please modify the UpdatePanel configuration or use RadAjaxManager for enabling the AJAX for your controls.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Jagat
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or