This is a migrated thread and some comments may be shown as answers.
Paging after rebind grid
6 Answers 130 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Neha Jain
Top achievements
Rank 1
Neha Jain asked on 03 May 2011, 07:42 AM
Hi,

I am facing this problem for many days. I tried to search for some solution for it but couldn't find any. 
My requirement is to fill the grid on the change of dropdown. I have implemented the same successfully but after rebind of grid I want to send the dropdown selected value to the Controller [Grid Action]. So that paging can working as desired.

Below is my View code:

 @(Html.Telerik().Grid(dt)
                .Name("QuestionList")
                        .Columns(columns =>
                        {
                            columns.AutoGenerate(column =>
                            {


                            });
                        })
                    .DataBinding(db => db.Ajax().Select("_QuestionList", "Page", new { PID = "<#= ProjectID #>" }).Enabled(true))
                     .Pageable(p => p.Enabled(true).PageSize(20))
                .Filterable(f => f.Enabled(true)).Groupable(g => g.Enabled(true)).Footer(true))
And my Controller

  [GridAction]      
        public ActionResult _QuestionList(string PID)
        {           
             DataSet ds = new DataSet();
            ds = ICT.Grid(PID);
            DataTable dt = new DataTable();
            dt = ds.Tables[0];
            var d = dt;
            ViewBag.d = d;    
            return View(new GridModel(dt));
        }   

I am not able to get <# ProjectID #> value. 

Can you please suggest me the best way to handle this issue?

Thanks !!

Neha J.

6 Answers, 1 is accepted

Sort by
0
Neha Jain
Top achievements
Rank 1
answered on 03 May 2011, 08:34 AM
I cehcked http://demos.telerik.com/aspnet-mvc/razor/grid/selectionclientside 
Paging is not working there too. 

Looking for a prompt reply.

Thanks !!!

Neha J.
0
Dickie
Top achievements
Rank 1
answered on 09 May 2011, 02:42 PM
I'm having a problem with this as well. Is there any way to make the paging and sorting work in this scenario? I'm binding my grid in the onchange client event handler of a dropdownlist. When I page, I lose the value of the dropdown.

function onDropDownListChange(e) {
            var pilotId = $("#pilotList").data("tDropDownList").value();
            $("#searchResultsGrid").data("tGrid").rebind({ pilotId: pilotId });
        }
0
Neha Jain
Top achievements
Rank 1
answered on 09 May 2011, 04:51 PM
Hi Dickie,

See if this can help you. 
http://demos.telerik.com/aspnet-mvc/grid/customtoolbar


Thanks,
Neha J.
0
Accepted
Dickie
Top achievements
Rank 1
answered on 09 May 2011, 05:02 PM
Thank you very much. That page had the information I needed. I just had to change that to work as follows:

function onDropDownListChange(e) {
    $("#searchResultsGrid").data("tGrid").rebind();
}
function OnSearchResultsGridDataBinding(e) {
    var pilotId = $("#pilotList").data("tDropDownList").value();
    e.data = $.extend(e.data, { pilotId: pilotId });
}
0
Anu
Top achievements
Rank 1
answered on 17 Jun 2011, 12:03 AM
I am also having issues with paging. Neha, were you able to get it to work?
0
Neha Jain
Top achievements
Rank 1
answered on 17 Jun 2011, 08:02 AM
Yes Anu, I got it working on Check out the demo link. It may help you.
Tags
Grid
Asked by
Neha Jain
Top achievements
Rank 1
Answers by
Neha Jain
Top achievements
Rank 1
Dickie
Top achievements
Rank 1
Anu
Top achievements
Rank 1
Share this question
or