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

q2 2009 radgrid: index [pagesize] is either negative or above rows count.

2 Answers 31 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Terry Hoiness
Top achievements
Rank 1
Terry Hoiness asked on 06 Aug 2009, 04:49 AM
After sorting with the radgrid then changing pages (or the reverse), I get: "index [pagesize] is either negative or above rows count."

The code is quite simple

    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
    {  
        DataTable dt = dm.GetDtFromSQL(string.Format(SQLTemplate, ViewState["showID"]), "", ViewState["showID"].ToString(), false);  
        if (dt.Rows.Count > 0)  
        {  
            DataView dv = dt.DefaultView;  
            dv.RowFilter = ViewState["filter"].ToString();  
            dv.Sort = string.Format("{0} {1}", ViewState["sort"], ViewState["order"]);  
            RadGrid1.DataSource = dv;  
        }  
        else  
        {  
            RadGrid1.DataSource = null;  
        }  
    } 

2 Answers, 1 is accepted

Sort by
0
Terry Hoiness
Top achievements
Rank 1
answered on 06 Aug 2009, 04:54 AM
DISREGARD.  I was sorting the datatable on every NeedDataSource() call... 
0
Nick
Telerik team
answered on 06 Aug 2009, 07:46 AM
Hi Terry Hoiness,

Thank you for sharing with the community the solution.

Best wishes,
Nick
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
GridView
Asked by
Terry Hoiness
Top achievements
Rank 1
Answers by
Terry Hoiness
Top achievements
Rank 1
Nick
Telerik team
Share this question
or