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

OnPopUpShowing not firing when grid has filters

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Liam
Top achievements
Rank 1
Liam asked on 03 Jun 2014, 09:09 AM
When I add filters to my grid it seems to stop OnPopUpShowing being fired in the client events and thus stops my edit form from appearing when it should.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LocationTerms.ascx.cs" Inherits="UnderwritingPlatform.Ui.Products.OnshoreEnergyCommon.Controls.LocationTerms" %>
<%@ Import Namespace="UnderwritingPlatform.Ui.Logic.OnshoreEnergyCommon.Models.Pricing" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function RowDblClick(sender, eventArgs) {
            sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
        }
        var popUp;
        function PopUpShowing(sender, eventArgs) {
            popUp = eventArgs.get_popUp();
            var gridWidth = sender.get_element().offsetWidth;
            var gridHeight = sender.get_element().offsetHeight;
            var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
            var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
            popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
            popUp.style.top = ((gridHeight - popUpHeight) / 2 + sender.get_element().offsetTop).toString() + "px";
            ApplyUiStyles();
        }
    </script>
</telerik:RadCodeBlock>

<telerik:RadAjaxManagerProxy ID="RadAjaxManager" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>

<telerik:RadGrid ID="RadGrid1"
    runat="server"
    CssClass="RadGrid"
    GridLines="None"
    AllowPaging="True"
    PageSize="20"
    AllowSorting="True"
    AutoGenerateColumns="False"
    ShowStatusBar="true"
    AllowAutomaticDeletes="True"
    AllowAutomaticInserts="True"
    AllowAutomaticUpdates="True"
    OnNeedDataSource="GetLocations"
    OnItemUpdated="RadGrid1_ItemUpdated"
    OnItemCommand="RadGrid1_ItemCommand"
    OnPreRender="RadGrid1_PreRender" AllowFilteringByColumn="True" >
    <MasterTableView CommandItemDisplay="None" EditMode="PopUp" DataKeyNames="Id" >

         <ColumnGroups>
            <telerik:GridColumnGroup HeaderText="Location Information" Name="LocationInformation" HeaderStyle-HorizontalAlign="Center" />
            <telerik:GridColumnGroup HeaderText="Insured Values" Name="InsuredValues" HeaderStyle-HorizontalAlign="Center" />
            <telerik:GridColumnGroup HeaderText="Loss Distribution Estimates" Name="LossDistributionEstimates" HeaderStyle-HorizontalAlign="Center" />
            <telerik:GridColumnGroup HeaderText="RA Rating" Name="RaRating" HeaderStyle-HorizontalAlign="Center" />
        </ColumnGroups>

        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"  ColumnGroupName="LocationInformation" >
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn UniqueName="ID" HeaderText="ID" DataField="Id" ColumnGroupName="LocationInformation" AllowFiltering="False">
                <HeaderStyle Width="20px"></HeaderStyle>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="LocationName" HeaderText="Location Name" DataField="LocationName" ColumnGroupName="LocationInformation" FilterControlWidth="50px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn  UniqueName="RatingSegment" HeaderText="" DataField="RatingSegment" ColumnGroupName="LocationInformation" FilterControlWidth="50px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="Occupancy" HeaderText="" DataField="Occupancy" ColumnGroupName="LocationInformation" FilterControlWidth="30px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="PdTivRounded" HeaderText="PD TIV" DataField="PdTivRounded" DataFormatString="{0:N1}" ColumnGroupName="InsuredValues" FilterControlWidth="30px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="BiRateableValueRounded" HeaderText="BI Rateable Value" DataField="BiRateableValueRounded" DataFormatString="{0:N1}" FilterControlWidth="30px" ColumnGroupName="InsuredValues" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="TotalTivRounded" HeaderText="Total TIV" DataField="TotalTivRounded" DataFormatString="{0:N1}" FilterControlWidth="40px" ColumnGroupName="InsuredValues" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="PmlPd" HeaderText="PML PD" DataField="PmlPd" DataFormatString="{0:N0}" ColumnGroupName="LossDistributionEstimates" FilterControlWidth="50px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="PmlBi" HeaderText="PML BI" DataField="PmlBi" DataFormatString="{0:N0}" ColumnGroupName="LossDistributionEstimates" FilterControlWidth="50px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="EmlPd" HeaderText="EML PD" DataField="EmlPd" DataFormatString="{0:N0}" ColumnGroupName="LossDistributionEstimates" FilterControlWidth="50px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="EmlBi" HeaderText="EML BI" DataField="EmlBi" DataFormatString="{0:N0}" ColumnGroupName="LossDistributionEstimates" FilterControlWidth="50px" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="RmProcRaRating" HeaderText="PD" DataField="RmProcRaRating" DataFormatString="{0:N0}" FilterControlWidth="30px" ColumnGroupName="RaRating" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="DesignConstrRaRating" HeaderText="BI" DataField="DesignConstrRaRating" FilterControlWidth="30px" DataFormatString="{0:N0}" ColumnGroupName="RaRating" AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
            <telerik:GridButtonColumn ButtonType="LinkButton" HeaderText="Total" DataTextField="TotalRaRating"  DataTextFormatString="{0:N0}" ColumnGroupName="RaRating"  AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" ShowFilterIcon="false"/>
        </Columns>
        <EditFormSettings EditFormType="Template" CaptionFormatString="Location Terms Detail">
            <PopUpSettings Modal="True" Width="800px" Height="800px" ShowCaptionInEditForm="true"></PopUpSettings>
            <FormTemplate>

                <div style="padding: 20px;">

                    <label class="popUpLabelTitle">Location Information</label>
                    <div class="twoColumnLeft">
                        <div>
                            <asp:Label ID="lblLocationName" runat="server" CssClass="standardLabel200" Text="Location name: "></asp:Label>
                            <asp:Label ID="lblLocationNameValue" runat="server" Text='<%# Bind("LocationName") %>'></asp:Label>
                        </div>

                        <div>
                            <asp:Label ID="lblRatingSegment" runat="server" CssClass="standardLabel200" Text="Generator Type: "></asp:Label>
                            <asp:Label ID="lblRatingSegmentValue" runat="server" Text='<%# Bind("RatingSegment") %>'></asp:Label>
                        </div>
                    </div>
                    <div style="float: left;">
                        <div>
                            <asp:Label ID="lblOccupancy" runat="server" CssClass="standardLabel200" Text="Generator Detail: "></asp:Label>
                            <asp:Label ID="lblOccupancyValue" runat="server" Text='<%# Bind("Occupancy") %>'></asp:Label>
                        </div>
                    </div>

                    <label class="popUpLabelTitle">Insured Values</label>
                    <div class="twoColumnLeft">
                        <div>
                            <asp:Label ID="lblPdTiv" runat="server" CssClass="standardLabel200" Text="PD TIV: "></asp:Label>
                            <asp:Label ID="lblPdTivValue" runat="server" CssClass="autoFormat" Text='<%# Bind("PdTiv") %>'></asp:Label>
                        </div>

                        <div>
                            <asp:Label ID="lblBiRateableValue" runat="server" CssClass="standardLabel200" Text="Bi Rateable Value: "></asp:Label>
                            <asp:Label ID="lblBiRateableValueValue" runat="server" CssClass="autoFormat" Text='<%# Bind("BiRateableValue") %>'></asp:Label>
                        </div>
                    </div>
                    <div style="float: left;">
                        <div>
                            <asp:Label ID="lblTotalTiv" runat="server" CssClass="standardLabel200" Text="Total TIV: "></asp:Label>
                            <asp:Label ID="lblTotalTivValue" runat="server" CssClass="autoFormat" Text='<%# Bind("TotalTiv") %>'></asp:Label>
                        </div>
                    </div>

                    <label class="popUpLabelTitle">RA Rating</label>
                    <div class="twoColumnLeft">
                        <div>
                            <asp:Label ID="lblRmProcRaRating" runat="server" CssClass="standardLabel200" Text="RM & Proc: "></asp:Label>
                            <asp:TextBox ID="txtRmProcRaRating" CssClass="autoFormat" runat="server" Text='<%# Bind("RmProcRaRating") %>'></asp:TextBox>
                        </div>

                        <div>
                            <asp:Label ID="lblDesignConstrRaRating" runat="server" CssClass="standardLabel200" Text="Design & Constr: "></asp:Label>
                            <asp:TextBox ID="txtDesignConstrRaRating" CssClass="autoFormat" runat="server" Text='<%# Bind("DesignConstrRaRating") %>'></asp:TextBox>
                        </div>
                    </div>
                    <div style="float: left;">
                        
                         <div>
                            <asp:Label ID="lblCorporateResilience" runat="server" CssClass="standardLabel200" Text="Corporate Resilience: "></asp:Label>
                            <asp:TextBox ID="lblCorporateResilienceValue" CssClass="autoFormat" runat="server" Text='<%# Bind("CorporateResilience") %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="lblTotalRaRating" runat="server" CssClass="standardLabel200" Text="Total: "></asp:Label>
                            <asp:TextBox ID="txtTotalRaRating" CssClass="autoFormat" runat="server" Text='<%# Bind("TotalRaRating") %>'></asp:TextBox>
                        </div>
                    </div>

                    <label class="popUpLabelTitle">Loss Distribution Estimates</label>

                    <div class="twoColumnLeft">
                        <div>
                            <asp:Label ID="lblSelectedPmlPd" runat="server" CssClass="standardLabel200" Text="Selected  PMLs PD: "></asp:Label>
                            <asp:TextBox ID="txtSelectedPmlPd" CssClass="autoFormat" runat="server" Text='<%# Bind("PmlPd") %>'></asp:TextBox>
                        </div>

                        <div>
                            <asp:Label ID="lblSelectedPmlBi" runat="server" CssClass="standardLabel200" Text="Selected  PMLs BI: "></asp:Label>
                            <asp:TextBox ID="txtSelectedPmlBi" CssClass="autoFormat" runat="server" Text='<%# Bind("PmlBi") %>'></asp:TextBox>
                        </div>
                    </div>
                    <div style="float: left;">
                        <div>
                            <asp:Label ID="lblSelectedEMLPd" runat="server" CssClass="standardLabel200" Text="Selected  EMLs PD: "></asp:Label>
                            <asp:TextBox ID="txtSelectedEMLPd" CssClass="autoFormat" runat="server" Text='<%# Bind("EmlPd") %>'></asp:TextBox>
                        </div>

                        <div>
                            <asp:Label ID="lblSelectedEMLBi" runat="server" CssClass="standardLabel200" Text="Selected  EMLs BI: "></asp:Label>
                            <asp:TextBox ID="txtSelectedEMLBi" CssClass="autoFormat" runat="server" Text='<%# Bind("EmlBi") %>'></asp:TextBox>
                        </div>
                    </div>

                    <label class="popUpLabelTitle">Location Coverage</label>

                    <div class="twoColumnLeft">
                        <div>
                            <asp:Label ID="Label3" runat="server" CssClass="standardLabel200" Text="BI Indemnity Basis "></asp:Label>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("BiIndemnityBasis") %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label4" runat="server" CssClass="standardLabel200" Text="BI Indemnity Period (Mths): "></asp:Label>
                            <asp:TextBox ID="TextBox2" Text='<%# Bind("BiIndemnityPeriod") %>' runat="server"></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label5" runat="server" CssClass="standardLabel200" Text="BI Indemnity Value Basis: "></asp:Label>
                            <asp:TextBox ID="TextBox3" Text='<%# Bind("BiIndemnityValueBasis") %>' runat="server"></asp:TextBox>
                        </div>
                    </div>
                    <div style="float: left">
                        <div>
                            <asp:Label ID="Label6" runat="server" CssClass="standardLabel200" Text="BI Sub-limit: "></asp:Label>
                            <asp:TextBox ID="TextBox4" CssClass="autoFormat" runat="server" Text='<%# Bind("BiSubLimit") %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label7" runat="server" CssClass="standardLabel200" Text="MB Sub-limit: "></asp:Label>
                            <asp:TextBox ID="TextBox5" CssClass="autoFormat" runat="server" Text='<%# Bind("MbSubLimit") %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label8" runat="server" CssClass="standardLabel200" Text="CBI/DEE Sub-limit: "></asp:Label>
                            <asp:TextBox ID="TextBox6" CssClass="autoFormat" runat="server" Text='<%# Bind("CbiSubLimit") %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label9" runat="server" CssClass="standardLabel200" Text="Power Extra Expense: "></asp:Label>
                            <asp:TextBox ID="TextBox7" CssClass="autoFormat" runat="server" Text='<%# Bind("PowerExtraSubLimit") %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label10" runat="server" CssClass="standardLabel200" Text='Replacement Power Included:'></asp:Label>
                            <asp:RadioButtonList runat="server" ID="radiotbutton1" RepeatLayout="Flow" RepeatDirection="Horizontal">
                                <asp:ListItem Text="Yes" Value="Yes" />
                                <asp:ListItem Text="No" Value="No" />
                            </asp:RadioButtonList>
                        </div>
                    </div>

                    <label class="popUpLabelTitle">Machine Component Deductibles</label>

                    <asp:Repeater ID="rptDeductibles" runat="server" DataSource='<%# (List<LocationTermsComponentDeductibleViewModel>)DataBinder.Eval( Container, "DataItem.ComponentDeductibles" ) %>'>

                        <HeaderTemplate>
                            <table class="popupTable">
                                <tr>
                                    <th></th>
                                    <th>&nbsp;PD</th>
                                    <th>&nbsp;BI (Days)</th>
                                    <th>&nbsp;MB PD</th>
                                    <th>&nbsp;MB BI (Days)</th>
                                    <th>&nbsp;CBI (Days)</th>
                                </tr>
                        </HeaderTemplate>


                        <ItemTemplate>
                            <tr>
                                <th><%# Eval("Name") %></th>
                                <td>
                                    <asp:TextBox ID="TextBox8" runat="server" CssClass="autoFormat" Text='<%# Bind("Pd") %>'></asp:TextBox></td>
                                <td>
                                    <asp:TextBox ID="TextBox9" runat="server" CssClass="autoFormat" Text='<%# Bind("Bi") %>'></asp:TextBox></td>
                                <td>
                                    <asp:TextBox ID="TextBox10" runat="server" CssClass="autoFormat" Text='<%# Bind("MbPd") %>'></asp:TextBox></td>
                                <td>
                                    <asp:TextBox ID="TextBox11" runat="server" CssClass="autoFormat" Text='<%# Bind("MbBi") %>'></asp:TextBox></td>
                                <td>
                                    <asp:TextBox ID="TextBox12" runat="server" CssClass="autoFormat" Text='<%# Bind("Cbi") %>'></asp:TextBox></td>
                            </tr>
                        </ItemTemplate>

                        <FooterTemplate>
                            </table>
                        </FooterTemplate>

                    </asp:Repeater>
                    
                    
                    <label class="popUpLabelTitle">Discretionary Premium Adjustments</label>

                    <asp:Repeater ID="rptDiscretionary" OnItemDataBound="rptDiscretionary_ItemDataBound" runat="server" DataSource='<%# (List<LocationTermsDiscretionaryViewModel>)DataBinder.Eval( Container, "DataItem.Discretionary" ) %>'>

                        <HeaderTemplate>
                            <table class="popupTable">
                                <tr>
                                    <th>&nbsp;Type</th>
                                    <th>&nbsp;Cover</th>
                                    <th>&nbsp;Reason</th>
                                    <th>&nbsp;Description</th>
                                    <th>&nbsp;Value</th>
                                </tr>
                        </HeaderTemplate>


                        <ItemTemplate>
                            <tr>
                                <td>
                                    <asp:DropDownList runat="server" ID="ddlDiscretionaryType" >
                                        <asp:ListItem>Test Item</asp:ListItem>
                                        </asp:DropDownList>

                                </td>
                                <td>
                                    <asp:DropDownList runat="server" ID="DropDownList1" >
                                        <asp:ListItem>Test Item</asp:ListItem>
                                        </asp:DropDownList>
                                <td>
                                    <asp:TextBox ID="TextBox10" runat="server" CssClass="autoFormat" Text='<%# Bind("Reason") %>'></asp:TextBox></td>
                                <td>
                                    <asp:TextBox ID="TextBox11" runat="server" CssClass="autoFormat" Text='<%# Bind("Description") %>'></asp:TextBox></td>
                                <td>
                                    <asp:TextBox ID="TextBox12" runat="server" CssClass="autoFormat" Text='<%# Bind("Value") %>'></asp:TextBox></td>
                            </tr>
                        </ItemTemplate>

                        <FooterTemplate>
                            </table>
                        </FooterTemplate>

                    </asp:Repeater>

                    <hr style="width: 100%;" class="hrBlue">

                    <div class="buttonContainer">
                        <asp:Button ID="btnUpdate" Text="Update" runat="server" CommandName="Update" />&nbsp;
                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel" />
                    </div>

                </div>
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>

    <PagerStyle AlwaysVisible="True" Mode="NextPrevAndNumeric"></PagerStyle>

    <FilterMenu OnClientShown="MenuShowing" />

    <ClientSettings>
        <ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="PopUpShowing"></ClientEvents>
    </ClientSettings>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jun 2014, 10:34 AM
Hi Liam,

Your code works fine at my end. I see that you have added OnClientShown function in the FilterMenu, but i don't see the code in JS. Please make sure that you have your code correctly coded in JS.

ASPX:
<FilterMenu OnClientShown="MenuShowing" />

JS:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function RowDblClick(sender, eventArgs) {
          //Your code
        }   
        function PopUpShowing(sender, eventArgs) {
         // Your Code
        }
        function MenuShowing() {
         // Your code
        }
    </script>
</telerik:RadCodeBlock>

Thanks,
Princy
Tags
Grid
Asked by
Liam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or