Page 1 of 1

Paging problem for run time query

Posted: Thu 18 Jun 2009 02:58
by jiayu821
I have a ASPxGridView and a Devart.OracleDataSource in my page,if i put the query in OracleDataSource in design time,

when i browse the page ,i can data and i can paging it, but if i put the query in OracleDataSource in run time,like this

protected void ASPxButton1_Click(object sender, EventArgs e)
{
string sqlText = "SELECT ...";
OracleDataSource1.SelectCommand = sqlText;
OracleDataSource1.DataBind();
}

i can get the first page of data,when i paging ,i can't get any data, and now if i click then button,i can also get the data,

but the page is not the first page ,it's the page i have paging before, what can i do to correct it ,and get the right data?

Posted: Thu 18 Jun 2009 13:48
by Shalex
Microsoft's SqlDataSource has the same behaviour. But you can set the current page index manually:

Code: Select all

protected void ASPxButton1_Click(object sender, EventArgs e)
{
string sqlText = "SELECT ...";
OracleDataSource1.SelectCommand = sqlText;
OracleDataSource1.DataBind();
ASPxGridView1.PageIndex = 0;
}