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

Clientside Row Selection Problem

10 Answers 257 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cristian Apavaloaiei
Top achievements
Rank 2
Cristian Apavaloaiei asked on 27 Oct 2010, 12:36 PM
I'm using Q2 2010.

In a grid with client-side row selection enabled by setting the clientsettings-selecting-allowrowselect property to true and adding a gridclientselectcolumn, the row selection is not working .
The style is not applied to the selected rows, on the server-side i can't see any rows as selected, and when checking the header checkbox that selects all rows, i get a javascript error 'Uncaught TypeError: Cannot call method '_selectAllRows' of null'.

The grid is inside a RadPageView, and the radmultipage is ajaxified using a RadAjaxManager. This is all placed in a .ascx file which is placed inside a sitefinity page. The master page references jquery 1.4.1, and has a RadScriptManager.

Another error i'm getting, which i don't know if is connected to this, is that each time an AJAX call is started, a resource fails to load (the url of the resource is [url of webpage]?rnd=[a date]. It might count that i'm using a custom skin built with the Visual StyleBuilder.

Any ideas about this particular problem?

Update:

I've managed to localize the problem some more. The problem is that the $find method called by the checkbox to return the grid returns null.
Now, the grid is on the third page of the RadMultiPage. I pass from one page to the other by AJAX calls, using a RadAjaxManager and a RadAjaxLoadingPanel. If i call the $find method the first time the page is loaded, it returns the right DOM object. However, if i call the same method with the same parameter (the id of the grid) after an AJAX call that updates the RadMultiPage, the $find method returns null. Note that this was working when i was using a .aspx page to hold all the content, but i wanted to add it to a Sitefinity page so i had to use a .ascx file.

Thanks

10 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 29 Oct 2010, 11:13 AM
Hello Cristian,

The information is not enough for us to identify the cause of the problem. Generally, it seems that the RadGrid client object is not initialized at the time you click on the select checkbox. If you look in the page HTML source, you should see a $create() statement for the RadGrid at the end of the source - is it there?

Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadGrid, {"ClientID":"RadGrid_Client_ID_here" ........................ }
}

Can you first check whether it is a Sitefinity-related problem by placing the user control on a regular web page outside Sitefinity?

Let us know what your findings are and send us the user control to test locally. Thank you.

Regards,
Dimo
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Al Franzini
Top achievements
Rank 1
answered on 27 Dec 2010, 10:13 PM
I have this same issue, when I placed the user control in a aspx page outside of Sitefinity it worked. Any update on this issue?

AjaxManager Settings:
 <telerik:AjaxSetting AjaxControlID="GridHere">
       <UpdatedControls>
           
<telerik:AjaxUpdatedControl ControlID="GridHere" />
       
</UpdatedControls>
  
</telerik:AjaxSetting> Inside the Grid I have a command custom template:
 <CommandItemTemplate>
     <asp:LinkButton ID="lnkRemoveSelected" CommandName="Delete" runat="server">Remove Selected</asp:LinkButton>
 </CommandItemTemplate>
It works the first time, but the next time the checkbox highlights but does not postback as selected. I noticed this javascript error in chrome:
Uncaught TypeError: Cannot call method '_selectAllRows' of null
(anonymous function):2
onclick
0
Radoslav Georgiev
Telerik team
answered on 31 Dec 2010, 12:09 PM
Hello Cristian Apavaloaiei,

The problem seems to be because the ajax settings are not applied properly after the first ajax request. Can you please check it the suggestions from the ticket you have opened with the same issue will resolve the problem?

All the best,
Radoslav Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Al Franzini
Top achievements
Rank 1
answered on 03 Jan 2011, 02:18 PM
The support ticket resolved my issue, thank you.
0
Tonino
Top achievements
Rank 1
answered on 30 Aug 2011, 04:15 PM
Hello!

It looks like I'm having the same problem...
Things where working with the classic telerik RadGrid. After switching to latest version of RadGrid I get the following error when clicking the 'select all rows' checkbox in the header of the grid (see attached screenshot).

Could someone please post the solution given by telerik for this problem in the ticket mentioned in this thread?

Thanks for helping!

Regards,
Tonino.
0
Radoslav Georgiev
Telerik team
answered on 01 Sep 2011, 03:29 PM
Hi Tonino,

Can you please show us sample of your markup? Are you using RadAjaxManager on your pages/user controls?

Greetings,
Radoslav Georgiev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Tonino
Top achievements
Rank 1
answered on 02 Sep 2011, 07:34 AM
Hi Radoslav

Here the markup with the classic RadGrid:
<radG:RadGrid ID="grid1" runat="server" AllowMultiRowSelection="True" AllowPaging="True"
    AllowSorting="True" AutoGenerateColumns="False" DataSourceID="sql1"
    GridLines="None" Skin="Dolphin" SkinsPath="~/RadControls/Grid/Skins" Visible="False"
    Width="100%" EnableViewState="True">
    <MasterTableView DataKeyNames="Ref" DataSourceID="sql1">
        <Columns>
            <radG:GridClientSelectColumn UniqueName="ClientSelectColumn">
                <HeaderStyle HorizontalAlign="Center" Width="15px" />
                <ItemStyle HorizontalAlign="Center" />
            </radG:GridClientSelectColumn>
            <radG:GridBoundColumn DataField="F1" HeaderText="F1" UniqueName="F1">
                <ItemStyle Width="90px" />
            </radG:GridBoundColumn>
            <radG:GridBoundColumn DataField="F2" HeaderText="F2" UniqueName="F2">
                <ItemStyle Width="90px" />
            </radG:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <PagerStyle AlwaysVisible="true" BackColor="WhiteSmoke" Height="25px" PageButtonCount="15"
        HorizontalAlign="Left" Mode="NextPrevNumericAndAdvanced" VerticalAlign="Middle" />
    <ClientSettings ApplyStylesOnClient="true">
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowClick="RowClick" />
    </ClientSettings>
</radG:RadGrid>

And here the markup with the latest version of RadGrid:
<telerik:RadGrid ID="grid1" runat="server" AllowMultiRowSelection="True" AllowPaging="True"
    AllowSorting="True" AutoGenerateColumns="False" DataSourceID="sql1"
    GridLines="None" Skin="Default"
    Width="100%" EnableViewState="True">
    <MasterTableView DataKeyNames="Ref">
        <Columns>
            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                <HeaderStyle HorizontalAlign="Center" Width="15px" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridClientSelectColumn>
            <telerik:GridBoundColumn DataField="F1" HeaderText="F1" SortExpression="F1" UniqueName="F1">
                <ItemStyle Width="90px" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="F2" HeaderText="F2" SortExpression="F2" UniqueName="F2">
                <ItemStyle Width="90px" />
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <PagerStyle AlwaysVisible="true" BackColor="WhiteSmoke" Height="25px" PageButtonCount="15"
        HorizontalAlign="Left" Mode="NextPrevNumericAndAdvanced" VerticalAlign="Middle" />
    <ClientSettings>
        <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True" />
    </ClientSettings>
</telerik:RadGrid>

I don't have RadAjaxManager on the page, just a classic RadAjaxPanel.

As for the problem when clicking the 'select all rows': I was hiding (visible=false) the grid on the beginning and I guess this was causing the problem. After setting visible=true and hiding the grid after page load the problem with the checkbox disappeared.

But now I noticed that the paging is not working... Changing the number of records per page has no effect. As you see I'm using NextPrevNumericAndAdvanced mode. Any idea what could be the problem? With the classic version of the RadGrid paging was working fine.

Regards,
Tonino.

0
Radoslav Georgiev
Telerik team
answered on 07 Sep 2011, 04:32 PM
Hello Tonino,

Can you please try setting the PageSize property on the Grid? You can also take a look at the RadGrid Paging demos for more samples on customizing the paging.

All the best,
Radoslav Georgiev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Tonino
Top achievements
Rank 1
answered on 08 Sep 2011, 09:40 AM
Hi Radoslav

Setting PageSize in the ASPX did not help... PageSize ist 10, regardless if set or not set in the ASPX.

Greetings,
Tonino.
0
Veli
Telerik team
answered on 13 Sep 2011, 03:18 PM
Hi Tonino,

The screen shot you have attached indicates the $find("[control-id]") object is null, meaning the RadGrid client component is not successfully found. Is this call to $find originating from your custom javascript? If, so, can you see if you are properly referencing the control with its ClientID?

Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Cristian Apavaloaiei
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Al Franzini
Top achievements
Rank 1
Radoslav Georgiev
Telerik team
Tonino
Top achievements
Rank 1
Veli
Telerik team
Share this question
or