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

Paging Postback Problems

5 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon-Jon Kershaw
Top achievements
Rank 2
Jon-Jon Kershaw asked on 05 Jan 2009, 05:12 PM
I have a selection for an event history and when I make the selection and hit the search button the radgrid posts but when I hit next page button the radgrid disappears then when I hit the search button again the second page appears.  I tried to add the radgrid to an update panel but it still does the same thing.  Do I have something not set right?  I added an ajaxmanager too but there is already one on the master default page.  Thanks in advance.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucEventHistory.ascx.cs" 
    Inherits="uc_mas_ucEventHistory" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
<style type="text/css">  
    .style1  
    {  
        width: 114px;  
    }  
</style> 
Data from mastermind here, rules need to be defined by <b>BUSINESS</b> 
<div id="EventHistoryContainer">  
    <asp:Table runat="server" ID="Eventhistorytable" Width="593px" Style="vertical-align: top">  
        <asp:TableRow> 
            <asp:TableCell ColumnSpan="4" HorizontalAlign="center" Style="border-bottom-style: double;  
                border-bottom-width: thin; border-bottom-color: Navy"> 
                <h3> 
                    <asp:Label ID="LabelTitle" runat="server">Event history Selection</asp:Label></h3>  
            </asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow Style="vertical-align: top; height: 25px;" VerticalAlign="top">  
            <asp:TableCell CssClass="style1">  
                <asp:Label ID="Label1" runat="server" Text="Start Date :"></asp:Label></asp:TableCell> 
            <asp:TableCell> 
                <telerik:RadDatePicker ID="RadDatePicker1" runat="server" Skin="Office2007" Culture="English (United States)" 
                    ValidationGroup="1" CausesValidation="True" DateInput-CausesValidation="True">  
                    <DateInput ID="DateInput1" LabelCssClass="radLabelCss_Office2007" Skin="Office2007" 
                        runat="server" CausesValidation="True">  
                    </DateInput> 
                    <Calendar ID="Calendar1" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
                        ViewSelectorText="x" Skin="Office2007" runat="server">  
                    </Calendar> 
                    <DatePopupButton runat="server"></DatePopupButton> 
                </telerik:RadDatePicker> 
            </asp:TableCell> 
            <asp:TableCell> 
                <asp:Label ID="Label2" runat="server" Text="Start Time :"></asp:Label></asp:TableCell> 
            <asp:TableCell> 
                &nbsp;  
                <telerik:RadTimePicker ID="RadTimePicker1" runat="server" Culture="English (United States)" 
                    Skin="Office2007" ValidationGroup="1" CausesValidation="True" DateInput-CausesValidation="True" 
                    DateInput-ValidationGroup="1">  
                    <Calendar runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
                        ViewSelectorText="x">  
                    </Calendar> 
                    <DatePopupButton Visible="False" CssClass="" ImageUrl="" HoverImageUrl=""></DatePopupButton> 
                    <TimeView runat="server" CellSpacing="-1">  
                    </TimeView> 
                    <TimePopupButton runat="server" CssClass="" ImageUrl="" HoverImageUrl=""></TimePopupButton> 
                    <DateInput runat="server" Width="" LabelCssClass="" CausesValidation="True" ValidationGroup="1">  
                    </DateInput> 
                </telerik:RadTimePicker> 
            </asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow> 
            <asp:TableCell CssClass="style1">  
                <asp:Label ID="Label3" runat="server" Text="End Date :"></asp:Label></asp:TableCell> 
            <asp:TableCell> 
                <telerik:RadDatePicker ID="RadDatePicker2" runat="server" Skin="Office2007" Culture="English (United States)" 
                    ValidationGroup="1" CausesValidation="True" DateInput-CausesValidation="True" 
                    DateInput-ValidationGroup="1">  
                    <DateInput ID="DateInput2" LabelCssClass="radLabelCss_Office2007" Skin="Office2007" 
                        runat="server">  
                    </DateInput> 
                    <Calendar ID="Calendar2" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
                        ViewSelectorText="x" Skin="Office2007" runat="server">  
                    </Calendar> 
                    <DatePopupButton runat="server"></DatePopupButton> 
                </telerik:RadDatePicker> 
            </asp:TableCell> 
            <asp:TableCell> 
                <asp:Label ID="Label4" runat="server" Text="End Time :"></asp:Label></asp:TableCell> 
            <asp:TableCell> 
                &nbsp;  
                <telerik:RadTimePicker ID="RadTimePicker2" runat="server" Culture="English (United States)" 
                    Skin="Office2007" ValidationGroup="1" CausesValidation="True" DateInput-CausesValidation="True" 
                    DateInput-ValidationGroup="1">  
                    <Calendar runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" 
                        ViewSelectorText="x">  
                    </Calendar> 
                    <DatePopupButton Visible="False" CssClass="" ImageUrl="" HoverImageUrl=""></DatePopupButton> 
                    <TimeView runat="server" CellSpacing="-1">  
                    </TimeView> 
                    <TimePopupButton runat="server" CssClass="" ImageUrl="" HoverImageUrl=""></TimePopupButton> 
                    <DateInput runat="server" Width="" LabelCssClass="" CausesValidation="True" ValidationGroup="1">  
                    </DateInput> 
                </telerik:RadTimePicker> 
            </asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow VerticalAlign="top">  
            <asp:TableCell> 
                <asp:Label runat="server" ID="lblMaxEvents" Text="Max Events to Return: "></asp:Label></asp:TableCell> 
            <asp:TableCell> 
                <telerik:RadComboBox ID="rdcMaxEvents" runat="server" ValidationGroup="1" CausesValidation="True">  
                    <Items> 
                        <telerik:RadComboBoxItem runat="server" Selected="True" Text="make a selection" Value="(none)" /> 
                        <telerik:RadComboBoxItem runat="server" Text="10" Value="10" /> 
                        <telerik:RadComboBoxItem runat="server" Text="20" Value="20" /> 
                        <telerik:RadComboBoxItem runat="server" Text="50" Value="50" /> 
                        <telerik:RadComboBoxItem runat="server" Text="100" Value="100" /> 
                        <telerik:RadComboBoxItem runat="server" Text="250" Value="250" /> 
                        <telerik:RadComboBoxItem runat="server" Text="500" Value="500" /> 
                        <telerik:RadComboBoxItem runat="server" Text="1000" Value="1000" /> 
                    </Items> 
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                </telerik:RadComboBox> 
            </asp:TableCell> 
            <asp:TableCell ColumnSpan="2"</asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow VerticalAlign="top">  
            <asp:TableCell> 
                <asp:Label runat="server" ID="lblGroupBy" Text="Group By Incident? "></asp:Label></asp:TableCell><asp:TableCell> 
                    <asp:RadioButtonList ID="rblGroupBy" runat="server" RepeatDirection="Horizontal" 
                        RepeatLayout="Flow">  
                        <asp:ListItem>Yes</asp:ListItem> 
                        <asp:ListItem Selected="True">No</asp:ListItem> 
                    </asp:RadioButtonList> 
                </asp:TableCell> 
            <asp:TableCell ColumnSpan="2"> &nbsp;</asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow VerticalAlign="top">  
            <asp:TableCell> 
                <asp:Label runat="server" ID="lblEntireSite" Text="Entire Site? "></asp:Label></asp:TableCell><asp:TableCell> 
                    <asp:RadioButtonList ID="rblEntireSite" runat="server" RepeatDirection="Horizontal" 
                        RepeatLayout="Flow">  
                        <asp:ListItem>Yes</asp:ListItem> 
                        <asp:ListItem Selected="True">No</asp:ListItem> 
                    </asp:RadioButtonList> 
                </asp:TableCell> 
            <asp:TableCell ColumnSpan="2"> &nbsp;</asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow VerticalAlign="top">  
            <asp:TableCell> 
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" /> 
            </asp:TableCell><asp:TableCell> &nbsp;</asp:TableCell> 
            <asp:TableCell ColumnSpan="2"> &nbsp;</asp:TableCell> 
        </asp:TableRow> 
        <asp:TableRow> 
            <asp:TableCell ColumnSpan="4">  
                <asp:Label runat="server" ID="lblError" Text="" Font-Bold="True" ForeColor="Red"></asp:Label></asp:TableCell> 
        </asp:TableRow> 
    </asp:Table> 
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">  
        <ContentTemplate> 
            <table> 
                <tr> 
                    <td> 
                    
                        <telerik:RadGrid ID="RadGrid2" runat="server" Visible="True" Skin="Vista" AllowPaging="True" 
                            AutoGenerateColumns="False" AllowFilteringByColumn="True" PageSize="5" BorderColor="Black" 
                            BorderStyle="Solid" OnPageIndexChanged="RadGrid2_PageIndexChanged">  
                            <HeaderContextMenu EnableTheming="True" Skin="Vista">  
                                <CollapseAnimation Duration="200" Type="OutQuint" /> 
                            </HeaderContextMenu> 
                            <MasterTableView> 
                                <RowIndicatorColumn> 
                                    <HeaderStyle Width="20px" /> 
                                </RowIndicatorColumn> 
                                <ExpandCollapseColumn> 
                                    <HeaderStyle Width="20px" /> 
                                </ExpandCollapseColumn> 
                                <Columns> 
                                    <telerik:GridBoundColumn HeaderText="additional_info" UniqueName="additional_info" 
                                        DataField="additional_info">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn HeaderText="alarminc_no" UniqueName="alarminc_no" DataField="alarminc_no">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn HeaderText="event_date" UniqueName="event_date" DataField="event_date">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn HeaderText="event_id" UniqueName="event_id" DataField="event_id">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn HeaderText="phone" UniqueName="phone" DataField="phone">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn HeaderText="system_no" UniqueName="system_no" DataField="system_no">  
                                    </telerik:GridBoundColumn> 
                                </Columns> 
                            </MasterTableView> 
                            <ClientSettings> 
                                <Selecting AllowRowSelect="True" /> 
                            </ClientSettings> 
                            <FilterMenu EnableTheming="True" Skin="Vista">  
                                <CollapseAnimation Duration="200" Type="OutQuint" /> 
                            </FilterMenu> 
                        </telerik:RadGrid> 
                    </td> 
                </tr> 
            </table> 
        </ContentTemplate> 
    </asp:UpdatePanel> 
</div> 

5 Answers, 1 is accepted

Sort by
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 05 Jan 2009, 05:44 PM
also noticed this javascript error too maybe this has something to do with it.

Error:  Sys.InvalidOperationException:  A control is already associated with the element.

URL:  //localhost:2269/WebSite/cui/default.aspx

that is my master page.
0
Accepted
Georgi Krustev
Telerik team
answered on 08 Jan 2009, 02:15 PM
Hello Jon,

As I reviewed the posted code I noticed that you are using simple data-biding. My assumption is that when you click the Search button you create a query and after its execution it returns the data which the grid is bound to.

Please verify that the grid is bound again with data when the OnPageIndexChanged event is fired, otherwise no data will be populated in by the grid.

I will suggest that you use advanced data-binding and have AllowPaging property set to true. Please refer to this online demo for more information about paging.
I hope this information helps.

Kind regards,
Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 08 Jan 2009, 04:38 PM
I refired the button search query upon selected index change and that seem to work but that seems like it should work differently.  Is this a correct way to do it?  I just didn't think that code behind was needed inorder to page.  Does the paging basically do a call each time but just for the select amount of records requested on the page?  So you aren't pulling a 100,000 grid you are just pulling the 5 each time.

Thanks for your help.
0
Georgi Krustev
Telerik team
answered on 10 Jan 2009, 12:26 PM
Hello Jonh,

When you are using paging the gird will get only the data which your data provider returns. That means when the data provider returns 1000 rows, the grid will take only the rows which it needs, but anyway you still will return 1000 rows every time when OnPageIndexChanged is raised. Grid needs only the rows which will be shown on the page, and needs all data when it performs filtering, sorting and grouping.
For further information about custom paging you can refer to this page.
I hope this helps.

Sincerely yours,
Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 12 Jan 2009, 05:36 PM
You guys are great at timely response to support issues.  Other companies could take weeks when I can expect an answer within 24-48 hours of initial post.  Definitely getting our moneys worth on your product.  Thanks again.

Tags
Grid
Asked by
Jon-Jon Kershaw
Top achievements
Rank 2
Answers by
Jon-Jon Kershaw
Top achievements
Rank 2
Georgi Krustev
Telerik team
Share this question
or