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

[Solved] RadGrid Client Side binding and page size change

1 Answer 349 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Santosh Bachuwar
Top achievements
Rank 1
Santosh Bachuwar asked on 22 May 2009, 02:40 PM
I have a radGrid and I am doing client-side binding. And I am using
PagerStyle Mode="NextPrevAndNumeric"

So when client changes the pageSize and I am trying to pass that information to my webservicerequest to get the new set of items as per that new pageSize as below

function RadGrid1_Command(sender, args) {
                //debugger;
                args.set_cancel(true);
                commandName = args.get_commandName();

                var searchText = $('.SearchText').val();
                var searchType = $('.SearchType').val();
                var searchId = $('.SearchID').val();
                var newPageSize = tableView.get_pageSize();
                tableView.set_pageSize(newPageSize);

                ISearchResultsService.getSearchResults(searchText, tableView.get_currentPageIndex(),
                            tableView.get_pageSize(), tableView.get_sortExpressions().toString(),
                            tableView.get_filterExpressions().toDynamicLinq(), searchType, searchId, updateGrid, onGetDataFailure2);
}

but I am manipulating columns in as below

function RadGrid1_RowDataBound(sender, args) {
                var imgbutton = args.get_item().findElement("img1"); // find control
                if (args.get_dataItem()["amazonThumbnailUrl"] != null && args.get_dataItem()["amazonThumbnailUrl"].toString() != "") {
                    imgbutton.src = args.get_dataItem()["amazonThumbnailUrl"].toString();
                }
                else {
                    imgbutton.src = "../Images/Listing/Thumbnails/" + args.get_dataItem()["ImageName"].toString();
                }
            }


But the HTML has only the initial pageSize and when it tries to rowDataBind the oldPageSize +1  it crashes since it cant find a value for Imgbutton in the above code, So what is work around for this situation to be able to change the pageSize in client side binding. I have also opened a support ticket, but thought posting here too for any workarounds?

Thanks

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 26 May 2009, 11:28 AM
Hello Santosh,

I believe that it was answered to the support ticket opened on the same matter. Here is a quote of the answer of my colleague:

Hi Santosh,

Thank you for getting back to us.

Unfortunately the described behavior is rather expected. When the page size of a client-side bound grid is changed, the ImageButtons for the new rows could not be created on the client. Therefore, you should add them manually, as it is done with the checkboxes in the attached sample.

Give it a try and let me know if this helps.

Regards,
Iana
the Telerik team


I will suggest you to keep the comunication in the support ticket in order to avoid duplication of questions.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Santosh Bachuwar
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or