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

Paging doesn't work

3 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vinh
Top achievements
Rank 1
Vinh asked on 23 Sep 2010, 10:48 PM

Hi,

The paging doesn't work correctly.  It only shows 1 page, while the record has more than 50 rows.  I attached the code below.

Thanks

Vinh

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="cubesstatus.aspx.cs" Inherits="SSI.cubesstatus" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <br />
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" 
            DataSourceID="SqlDataSource1" GridLines="None" 
            ShowGroupPanel="True" Skin="Vista" AllowAutomaticUpdates="True" 
            AutoGenerateEditColumn="True">
            <PagerStyle AlwaysVisible="True" />
<MasterTableView AllowCustomPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" 
                DataSourceID="SqlDataSource1" EditMode="PopUp">
  
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
  
    <DetailTables>
        <telerik:GridTableView DataKeyNames="CubeID" DataSourceID="SqlDataSource2" Width="100%"
                                runat="server" AutoGenerateColumns="False" 
            AllowAutomaticUpdates="False" AllowSorting="True" EditMode="InPlace">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="CubeID" MasterKeyField="ID" />
                                </ParentTableRelation>
  
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="cubename" HeaderText="Cube name" HeaderButtonType="TextButton"
                                        DataField="cubename" UniqueName="cubename" ReadOnly="True">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" HeaderButtonType="TextButton"
                                        DataField="Status" UniqueName="Status" ReadOnly="True">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="lastcheck" HeaderText="Last check" HeaderButtonType="TextButton"
                                        DataField="lastcheck" UniqueName="lastcheck" ReadOnly="True">
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <AlternatingItemStyle BackColor="#99CCFF" ForeColor="White" />
                                <PagerStyle AlwaysVisible="True" />
                            </telerik:GridTableView>
  
    </DetailTables>
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
  
<ExpandCollapseColumn Visible="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>
        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" 
            ReadOnly="True" SortExpression="ID" UniqueName="ID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="CatalogName" HeaderText="CatalogName" 
            SortExpression="CatalogName" UniqueName="CatalogName" ReadOnly="True">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="CubeName" HeaderText="CubeName" 
            SortExpression="CubeName" UniqueName="CubeName" ReadOnly="True">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ServerName" HeaderText="ServerName" 
            SortExpression="ServerName" UniqueName="ServerName" ReadOnly="True">
        </telerik:GridBoundColumn>
        <telerik:GridCheckBoxColumn DataField="Monitor" DataType="System.Boolean" 
            HeaderText="Monitor" SortExpression="Monitor" UniqueName="Monitor">
        </telerik:GridCheckBoxColumn>
    </Columns>
    <AlternatingItemStyle BackColor="#99CCFF" ForeColor="White" />
    <PagerStyle AlwaysVisible="True" />
    <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" 
        Font-Strikeout="False" Font-Underline="False" Wrap="True" />
</MasterTableView>
            <ClientSettings AllowDragToGroup="True">
            </ClientSettings>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:csSSIReports %>" 
              
              
            SelectCommand="SELECT [ID], [CatalogName], [CubeName], [ServerName], [Monitor] FROM [tblCubes]" 
            UpdateCommand="UPDATE tblCubes SET Monitor = @Monitor WHERE (ID = @ID)">
             <UpdateParameters>
                <asp:Parameter Name="Monitor" />            
                 <asp:Parameter Name="ID" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:csSSIReports %>" 
          
        SelectCommand="SELECT SS.CubeID, S.CubeName, SS.Status, SS.LastCheck FROM tblCubeStatus AS SS INNER JOIN tblCubes AS S ON S.ID = SS.CubeID WHERE (SS.CubeID = @CubeID)">
        <SelectParameters>
                <asp:Parameter Name="CubeID" />
            </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>

 

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Sep 2010, 01:05 PM
Hello Vinh,


When setting AllowCustomPaging  property to True, you need to implement code logic which to extract merely a fixed number of records from the grid source and present them in the grid structure. If you are not using custom paging technique, then set the property as false. I hope that will work.


Thanks,
Princy.
0
Vinh
Top achievements
Rank 1
answered on 27 Sep 2010, 01:58 PM
I don't think it's the problem, b/c even when I removed that, the problem still there.

Thanks

Vinh
0
Vinh
Top achievements
Rank 1
answered on 27 Sep 2010, 02:51 PM
Well, consider this problem is solved.  I don't know what happened, but when I go back to the property builder, carefully unselect allowpaging then save and then select again and save.  There it is, its working.  The code must be altered somewhere somehow.

Thanks all

VInh
Tags
Grid
Asked by
Vinh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Vinh
Top achievements
Rank 1
Share this question
or