This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > How to reset CurrentPageIndex





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to reset CurrentPageIndex
tofutown

2004-03-22, 2:36 pm

I'm writing an asp.net app that allow the user to do a search and displays the
results inside a datagrid.

It gave me the 'Invalid CurrentPageIndex Calue. It must be >=0 and < the page
count' error.

Although I know WHY this error is appearing: the user searches, and then goes
through the pages of the datagrid results to, say, page 30. Then, he do another
search (without leaving the page or returning to page 1 of the datagrid
paging). If the 2nd search has <30 pages, it will generate this error, because
according to the app, the currentpageindex is still at 30.
Does anybody know how to refresh the datagrid so that each time the user
presses the Search button, the currentpageindex is sent back to 0?

Thanks

Adenocard

2004-08-04, 7:15 pm

Ever get a resolution to this??

Anyone have any ideas how to programmatically set CurrentPageIndex using the
Dreamweaver controls on postback?

/*
* Check to see if this page was posted back, and if so was it due to a
dynamic drop down
* or to a page index change in the DataGrid? If it was due to a dynamic
drop down [I wanna see the 'volunteers' of a
* specific 'group'] then set the current page index back to 0, so we are on
the first page.
*/
protected override void OnPreRender(EventArgs e)
{
if(Page.IsPostBack)
{
if(Request.Form["__EVENTTARGET"] == "ddlVolSector")
{
// DOESNT WORK
dsVolunteers.CurrentPageIndex = 0;
// DOESNT WORK
dsVolunteers.CurrentPageIndex--;
// DOESNT WORK
DreamweaverCtrls.DataSet.CurrentPageIndex = 0;
}
}
}

Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews