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

Rad Grid row expand with Update panel.

1 Answer 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
chirag
Top achievements
Rank 1
chirag asked on 05 Jan 2016, 08:33 AM

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.

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 07 Jan 2016, 01:04 PM
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
Tags
General Discussions
Asked by
chirag
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or