Rad Grid row expand with Update panel.

2 posts, 0 answers
  1. chirag
    chirag avatar
    3 posts
    Member since:
    Jan 2016

    Posted 05 Jan Link to this post

    Hi Team,

    I am implementing Rad Grid in my project. In it I am expanding row from client side through ClientSetting -> CleintEvent -> OnRowClick. it works fine when I was not having update panel. When I put this grid inside ASP .NET update panel, the client function named RowClick not firing after page post back. Below is my code.

    Update panel code:

    <asp:UpdatePanel ID="updOnlinePaymentHistory" runat="server">
            <ContentTemplate>

            ..............................

     </ContentTemplate>
        </asp:UpdatePanel>

     

    Grid HTML Code:

    <telerik:RadGrid ID="gridPayment" 
                                    AllowPaging="true" 
                                    PageSize="24" 
                                    runat="server" 
                                    AllowSorting="true" 
                                    CellSpacing="0" 
                                    GridLines="Horizontal" 
                                    CssClass="table-responsive"
                                    OnItemDataBound="grdPayment_ItemDataBound" 
                                    OnPageIndexChanged="gridPayment_PageIndexChanged" 
                                    EnableGroupsExpandAll="false" 
                                    RegisterWithScriptManager="False">

     

                              ............. Grid columns code .....................

     

                                    <ClientSettings>
                                        <ClientEvents OnRowClick="RowClick" />
                                    </ClientSettings>

                                </telerik:RadGrid>

     

    javascript function:

    function RowClick(sender, args) {
                  var item = args.get_item();
                  var lastState = item.get_expanded();
                  var Grid = $find("<%= gridPayment.ClientID %>");
                  var MasterTable = Grid.get_masterTableView();
                  for (var i = 0; i < MasterTable.get_dataItems().length; i++) {
                    var row = MasterTable.get_dataItems()[i];
                    row.set_expanded(false);
                  }
                  item.set_expanded(!lastState);

            }

     

     

    When I load page, it works fine. but after page postback the RowClick function not getting called.

    Can anyone please guide me what wrong I am doing.

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 07 Jan Link to this post

    Hi Chirag,

    Would you open the browser console by pressing F12 and see if there are any errors listed? If there are JavaScript errors the client-side code will not be executed.

    Also, please ensure that the custom JavaScript you have is wrapped in a RadScriptBlock.



    Regards,
    Viktor Tachev
    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
Back to Top