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

Grid, paging and postback

4 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sylvain
Top achievements
Rank 1
Sylvain asked on 19 Jul 2011, 03:37 PM
Hello all

I am using a radgrid with a pager :

<telerik:RadGrid ID="ResultsGrid" runat="server" AllowPaging="True" AllowSorting="True" OnSortCommand="RadGrid_SortCommand" EnableViewState="true"
                         AutoGenerateColumns="False" GridLines="None"  ShowHeader="true"
                         PageSize="7" OnItemCommand="HandleDoubleclick" Width="99%">
        <MasterTableView DataKeyNames="Id,Abstract,InternalId" CanRetrieveAllData="false">
            <Columns>
[...]

Then in the UI, when the user clicks on a page number, there is a postback (as it seems) that makes the user wait for the reloading (which is fine); but when he clicks on the button "Next page" or "Previous page", there is not this postback ... so we have the feeling that nothing happened for 1 or 2 sec. and then the page changes.
How can I have the same behavior as for when we click on the page numbers ?
Thanks for your help,
Sylvain

4 Answers, 1 is accepted

Sort by
0
Sylvain
Top achievements
Rank 1
answered on 26 Jul 2011, 08:52 AM
Hi all
Let me reformulate my question :
Is there a way (an event or so...) to detect when a user clicks on one of the following buttons : Next, Prev, First and Last ?

I  have seen the ItemCommand event, but it is called after a small delay, so we still have the impression that nothing happened when we clicked on the button. While, when you click on the page number, the postback is immediate.

Thanks again for your help
Sylvain
0
Shinu
Top achievements
Rank 2
answered on 26 Jul 2011, 09:14 AM
Hello Sylvian,

After inspecting your code, I suppose that you are using Simple data-binding through the DataBind() method which can be used in simple scenarios. In order to implement complex operations like paging, filtering etc Advanced Data Binding through NeedDataSource event is preferred.
Advanced Data-binding (using NeedDataSource event).

Thanks,
Shinu.
0
Sylvain
Top achievements
Rank 1
answered on 26 Jul 2011, 09:31 AM
Hello Shinu and thank you for your answer

I do bind using NeedDataSource, it is done in the code behind though :

ResultsGrid.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(BindDataSource);
 
 
[...]
 
private void BindDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        if (!e.IsFromDetailTable)
        {
            ResultsGrid.MasterTableView.DataSource = GetDataSource();
        }
    }
0
Sylvain
Top achievements
Rank 1
answered on 28 Jul 2011, 06:21 PM
No one ?
Tags
Grid
Asked by
Sylvain
Top achievements
Rank 1
Answers by
Sylvain
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or