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

Change RadGrid RowCount in the client side.

5 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nithya Rani
Top achievements
Rank 1
Nithya Rani asked on 20 Mar 2013, 09:08 AM
Hi,

In my RadGrid 10 rows are displaying while clicking the linkbutton which is outside the grid my grid should display 20 rows per page. Any one can help me on this.

Regards,
Nithya

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 20 Mar 2013, 11:08 AM
Hello,

var grid = $find("<%=RadGrid1.ClientID %>"); 
                   var MasterTable = grid.get_masterTableView(); 
            MasterTable .set_pageSize(YourNewPageSize);
                   MasterTable.rebind(); 


Thanks,
Jayesh Goyani
0
Nithya Rani
Top achievements
Rank 1
answered on 20 Mar 2013, 01:40 PM
Hi Jayesh,

Its not working for me. What happening is i click the link button in the client click i have return the below code

function pager() {

var grid = $find("<%=RadGrid_orderstatus.ClientID %>");

 

var MasterTable = grid.get_masterTableView();

MasterTable.set_pageSize(30);

MasterTable.rebind();

}

<asp:LinkButton ID="LinkButton1" runat="server" class="btn-slide" OnClientClick="pager();return false;"></asp:LinkButton>


Page is getting loaded so again for me its displaying same 10 rows only. its not updating

Regards,
Nithya
0
Angel Petrov
Telerik team
answered on 25 Mar 2013, 07:37 AM
Hello Nithya,

Please modify the logic like demonstrated below:
function pager()
        {
            var grid = $find("<%=RadGrid_orderstatus.ClientID %>");
            var MasterTable = grid.get_masterTableView();
            MasterTable.set_pageSize(30);
        }

When the set_pageSize method is called there is no need to call rebind() as the set_pageSize method  will call it for you. Give this approach a try and let us know how it went.

Kind regards,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Nithya Rani
Top achievements
Rank 1
answered on 26 Mar 2013, 05:02 AM
Hi Angel Petrov,

Thanks Grid row count is changing but page is getting loaded which i don't want. Below is my scenario

In my Page i have header part and the grid part. When i click the arrow link header part should be collapsed and grid count should be changed to 30. When i click the arrow again my header should be expand and the grid row count should be 10. Below is my code after putting the grid row count functionality my collapse is  not working.

JQuery

  $(document).ready(function () {
            $(".btn-slide").click(function () {
                $("#panel").slideToggle("slow");
                $(this).toggleClass("active");
               
var grid = $find("<%=RadGrid_orderstatus.ClientID %>");
                var MasterTable = grid.get_masterTableView();
                var row = MasterTable.get_dataItems();                 
                if (row.length == 30) {                  
                    MasterTable.set_pageSize(10);                    
                }
                else {                    
                    MasterTable.set_pageSize(30);
                }
               
                return false;
            });

        });

HTML

 <p class="slide">
            <a href="#" class="btn-slide">&nbsp;</a>
  </p>


Regards,
Nithya
0
Angel Petrov
Telerik team
answered on 29 Mar 2013, 06:39 AM
Hi Nithya,

I am sorry to say but the behavior experienced is expected. When the page size of the grid is changed RadGrid needs to recreate it structure and fires a postback. As for why the expand functionality mentioned does not work after the postback it would be hard to tell without replicating the issue. Please revise the requirements and let us know if we could advice you further.

Kind regards,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Nithya Rani
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Nithya Rani
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or