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

Paging with Selectcommand from codebehind

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fer
Top achievements
Rank 1
fer asked on 08 Sep 2010, 02:29 PM
Hi

I use radgrid with SqlDataSource and paging enabled.
On asp page there is a select command in sqldatasource.

On codebehind i change select command of sqldatasource when page loads and on some circumstances
it works ok at first page.

but when click next page or any page on pager
it clears the sqlcommand which i changed from codebehind and gets the records according to the
sqldatasource's select command which i put asp page at first.

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 09 Sep 2010, 01:35 PM
Hi,

Could you please ensure that SqlDataSource's SelectCommand value is explicitly set on every request (on Page's Init or Load stage for example) as this value is not persisted in the ViewState across postbacks.

All the best,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
fer
Top achievements
Rank 1
answered on 09 Sep 2010, 02:30 PM
ok. works. thanks.

every page changement requires sqlcommand refreshment.
so grid only keeps on just which record it is. and if the command is same goes to the page which is required
am i correct ?..
Tags
Grid
Asked by
fer
Top achievements
Rank 1
Answers by
Rosen
Telerik team
fer
Top achievements
Rank 1
Share this question
or