Alessandro Zifiglio
2/20/2004 1:18:00 PM
dont think its the arraylist, however still, i cant figure why this is not
working for you. All code in your OnpageIndexChange method is correct ;P
"Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> wrote in
message news:iGlZb.9506$HO2.5916@news.edisontel.com...
> As elements are added to an ArrayList, the capacity is automatically
> increased as required through reallocation. I could easily be wrong as i'm
> not testing this but at first look i see you have created an arraylist of
5
> elements and are actually loading in 4 elements but the count really
starts
> from zero which cuts the count to actually 3, zero being your first
element
> and so on.
>
> ArrayList a = new ArrayList(3);
> or
> just
> ArrayList a = new ArrayList();
>
> "Maverick" <anonymous@discussions.microsoft.com> wrote in message
> news:B2F52163-0DA3-4DB8-8188-252D62515162@microsoft.com...
> > Hello,
> > I'm trying to make a datagrid with paging the datasource is a simpel
> arraylist with 5 elements. When the page is loaded i
> > see the first item (pagesize = 1) but when I click next i get at index
out
> of range exception.
> > The OnpageIndexChange code:
> > private void pageChange(Object sender, DataGridPageChangedEventArgs e)
> > {
> > reports.CurrentPageIndex = e.NewPageIndex;
> > loadReports();
> > }
> >
> > private void loadReports()
> > {
> > ArrayList a = new ArrayList(5);
> > a.Add("test 1");
> > a.Add("test 2");
> > a.Add("test 3");
> > a.Add("test 4");
> > reports.DataSource = a;
> > reports.DataBind();
> > }
> >
> > Can anyone help? Please!!!
>
>