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

Missing content after pageloads

3 Answers 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 1
Morten asked on 24 Aug 2011, 11:27 AM
Hi,

I'm new to Telerik, and thus I'm trying out some of your examples to familiarize myself.

I only downloaded the dll's, and added the axd to my existing web.config. Following, I've tried to incorporate a number of different demos into my website. I can make them work on the initial page load, but using paging results in an empty control after pageload. The simplest instance I've tried is:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/simplebinding/defaultcs.aspx

Inserted the exact same RadScriptManager, RadAjaxManager and RadGrid into my aspx, and added the codebehind - only changed the query and connectionstring.

First pageload works, but after trying to go to any other page (there's 50 pages of records), it results in an empty rad grid container:

<div id="phcontent_0_phcontent_0_RadGrid1Panel" style="display: block; ">
  <div id="phcontent_0_RadGrid1" class="RadGrid RadGrid_Default" style="width:97%;"
  <!-- 2011.2.712.35 -->
  <input id="phcontent_0_RadGrid1_ClientState" name="phcontent_0_RadGrid1_ClientState" type="hidden" autocomplete="off">
  </div>
</div>


There are no javascript errors, and the call to Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=phcontent_0_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b

has the content
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
(function() {
      function loadHandler() {
          var hf = $get('phcontent_0_RadScriptManager1_TSM');
          if (!hf) return;
          if (!hf._RSM_init) { hf._RSM_init = true; hf.value = ''; }
          hf.value += ';';                                    
          Sys.Application.remove_load(loadHandler);
      };
      Sys.Application.add_load(loadHandler);
  })();


Does anyone have an idea as to what I'm doing wrong?

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 24 Aug 2011, 11:36 AM
Hello Morten,

Do you load the data in the grid (intercepting the OnPageIndexChanged event) as presented in the example? If you do not, this can result in an empty grid when you change the active page.

An alternative solution (which will spare you some coding) would be to use advanced binding with NeedDataSource event handling as illustrated here.

Regards,
Sebastian
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Morten
Top achievements
Rank 1
answered on 24 Aug 2011, 12:02 PM
Hi Sebastian,

I can try the NeedDataSource later, but as for intercepting the OnPageIndexChanged event, I've implemented it exactly as in the test, copy paste from my code :

aspx:
<telerik:RadGrid ID="RadGrid1" OnSortCommand="RadGrid1_SortCommand" OnPageIndexChanged="RadGrid1_PageIndexChanged" Width="90%"
   OnPageSizeChanged="RadGrid1_PageSizeChanged" AllowSorting="True" PageSize="15" AllowPaging="True" AllowMultiRowSelection="True" runat="server" Gridlines="None">
    <MasterTableView Width="90%" Summary="RadGrid table" />   
    <PagerStyle Mode="NextPrevAndNumeric" />
</telerik:RadGrid>

C#:
protected void RadGrid1_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)
        {
            LoadData();
        }

When attaching to the process, I see that Page_Load is entered, but nothing is done due to postback, however RadGrid1_PageIndexChanged (or any of the other functions for that matter) is never entered.

I have tried with AutoEventWireup true and false, with no difference.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TelerikTest.ascx.cs" Inherits="DanskMetal.AccessToWeb.Web.TelerikTest" %>

0
Morten
Top achievements
Rank 1
answered on 24 Aug 2011, 01:20 PM
The other solution you proposed with NeedDataSource works fine, thanks :)
Tags
General Discussions
Asked by
Morten
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Morten
Top achievements
Rank 1
Share this question
or