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

Grid paging stops working after publishing

2 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Drew
Top achievements
Rank 1
Drew asked on 07 Dec 2011, 08:13 PM
I have created a web page using a Telerik Grid bound to a SqlDataSource to allow users to page through some data.  Everything works correctly on my local machine, but when I publish it to the production server, it shows the first page of data but nothing else.  Clicking on the navigation links only brings back the first page as does attempting to filter or sort the data.  What could be causing this?

Grid Code:


<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadGrid ID="CustomerInfoGrid" runat="server"
        AutoGenerateColumns="False" CellSpacing="0" DataSourceID="CRMData"
        GridLines="None" AllowPaging="True" PageSize="20"
        AllowFilteringByColumn="True"
        AllowSorting="True">
        <MasterTableView DataKeyNames="CustomerID" DataSourceID="CRMData">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
         
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
 
            <Columns>
                <telerik:GridTemplateColumn UniqueName="GenerateSupportCode" AllowFiltering="False" Groupable="False" HeaderText="Support Code"
                    Reorderable="False" ShowSortIcon="False"></telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="CustomerID" DataType="System.Int32" FilterControlAltText="Filter CustomerID column" HeaderText="Customer ID"
                    ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CustomerName" FilterControlAltText="Filter CustomerName column" HeaderText="Customer Name"
                    SortExpression="CustomerName" UniqueName="CustomerName"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FingerprintData"
                    FilterControlAltText="Filter CustomerName column" Display="False"
                    SortExpression="FingerprintData" UniqueName="FingerprintData"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="ClearFingerprintDataColumn"
                    AllowFiltering="False" Groupable="False" HeaderText="Fingerprint Data"
                    Reorderable="False" SortExpression="FingerprintData"></telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="LicenseData"
                    FilterControlAltText="Filter CustomerName column" Display="False"
                    SortExpression="LicenseData" UniqueName="LicenseData"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="ClearLicenseDataColumn"
                    AllowFiltering="False" Groupable="False" HeaderText="License Data"
                    Reorderable="False" SortExpression="LicenseData"></telerik:GridTemplateColumn>
            </Columns>
         
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
            </EditFormSettings>
        </MasterTableView>
     
        <PagerStyle Position="TopAndBottom" />
     
        <FilterMenu EnableImageSprites="False">
            <WebServiceSettings>
                <ODataSettings InitialContainerName=""></ODataSettings>
            </WebServiceSettings>
        </FilterMenu>
 
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            <WebServiceSettings>
                <ODataSettings InitialContainerName=""></ODataSettings>
            </WebServiceSettings>
        </HeaderContextMenu>
    </telerik:RadGrid>
 
    <asp:SqlDataSource ID="CRMData" runat="server"
        ConnectionString="<%$ ConnectionStrings:CRMConnectionString %>"
        SelectCommand="SELECT [CustomerName], [CustomerID], [LicenseData], [FingerprintData] FROM [Customers] WHERE ([Deleted] = @Deleted) ORDER BY [CustomerName]">
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="Deleted" Type="Byte" />
        </SelectParameters>
    </asp:SqlDataSource>
</form>

Codebehind:

protected void CustomerInfoGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        Button btn = null;
        GridDataItem dataItem = e.Item as GridDataItem;
 
        btn = new Button();
        btn.OnClientClick = String.Format("return GetSupportCode({0})", dataItem["CustomerID"].Text);
        btn.Text = "Generate";
        dataItem["GenerateSupportCode"].Controls.Add(btn);
 
        dataItem["FingerprintData"].Text = dataItem["FingerprintData"].Text.Replace(" ", "");
        if (!String.IsNullOrEmpty(dataItem["FingerprintData"].Text.Trim()))
        {
            btn = new Button();
            btn.OnClientClick = String.Format("return ClearFingerprintData({0})", dataItem["CustomerID"].Text);
            btn.Text = "Clear";
            dataItem["ClearFingerprintDataColumn"].Controls.Add(btn);
        }
 
        dataItem["LicenseData"].Text = dataItem["LicenseData"].Text.Replace(" ", "");
        if (!String.IsNullOrEmpty(dataItem["LicenseData"].Text.Trim()))
        {
            btn = new Button();
            btn.OnClientClick = String.Format("return ClearLicenseData({0})", dataItem["CustomerID"].Text);
            btn.Text = "Clear";
            dataItem["ClearLicenseDataColumn"].Controls.Add(btn);
        }
 
    }
}

2 Answers, 1 is accepted

Sort by
0
Drew
Top achievements
Rank 1
answered on 07 Dec 2011, 08:56 PM
Apparently I've found the culprit.  If I go to http://sitename, paging, sorting and filtering do not work.  However, if I go to http://sitename/default.aspx (which is the default page), everything works as it should.  As a temporary fix, I'll add a default.htm in as a redirector to default.aspx, but I'd like to know what's causing this and if there's a more permanent fix.
0
Iana Tsolova
Telerik team
answered on 08 Dec 2011, 10:49 AM
Hello Drew,

This issue is due to a breaking change in .NET 4.0. Find the solution for it at the bottom of this topic (Known issues section).

Let me know if this helps.

All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Drew
Top achievements
Rank 1
Answers by
Drew
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or