set_virtualItemCount(count) doesn't work?

4 posts, 0 answers
  1. Elton
    Elton avatar
    98 posts
    Member since:
    Oct 2007

    Posted 09 Oct 2008 Link to this post

    Hello,

    I am trying to do paging with client side data binding.

    masterTbView.set_dataSource(result);

    masterTbView.dataBind();

    masterTbView.set_virtualItemCount(1000);

    ....

    but the set_virtualItemCount() doesn't have any effect at all. On the footer it always give me Page 1 at all.
    I tried the example on your site it works fine.

    Just wonder if you can give us some hints on this issue, like what attribute we should turn on, or what event handler we should implement?

    Thank you very much,
    Elton

     

  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 14 Oct 2008 Link to this post

    Hello Elton,

    You can find working example here. And it seems to be working.
    Can you show us a little bit of your code?

    Regards,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brett Howard
    Brett Howard avatar
    4 posts
    Member since:
    Feb 2007

    Posted 21 Nov 2008 Link to this post

    We are having a similar issue with the .set_virtualItemCount() which causes an exception everytime we try to set the property.

    tableView.set_virtualItemCount(e.TotalRowCount); //Here is where the exception is generated. In the debugger we get the following exception : Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
    Parameter name: id

    Does anyone know why this is happening.
    Below is the sample markup.

    Additional Info :
    The tableView.set_virtualItemCount() method throws an exception if we provide any int value.
    The data is able to bind as long as we do not set this property.

    VS2008
    .NET 3.5


     

     

    <telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="false" runat="server">

     

     

     

     

     

    <MasterTableView>

     

     

     

     

     

    <Columns>

     

     

     

     

     

    <telerik:GridBoundColumn DataField="NewId" SortExpression="NewId" HeaderText="Id"></telerik:GridBoundColumn>

     

     

     

     

     

    <telerik:GridBoundColumn DataField="FirstName" SortExpression="FirstName" HeaderText="First Name"></telerik:GridBoundColumn>

     

     

     

     

     

    <telerik:GridBoundColumn DataField="LastName" SortExpression="LastName" HeaderText="Last Name"></telerik:GridBoundColumn>

     

     

     

     

     

    <telerik:GridBoundColumn DataField="DOB" SortExpression="DOB" DataType="System.DateTime" HeaderText="Date of Birth"></telerik:GridBoundColumn>

     

     

     

     

     

    </Columns>

     

     

     

     

     

    <NoRecordsTemplate>

     

     

     

     

    No Records Available

     

    </NoRecordsTemplate>

     

     

     

     

     

     

    </MasterTableView>

     

     

     

     

     

    <ClientSettings>

     

     

     

     

     

    <ClientEvents OnCommand="RadGrid1_Command" />

     

     

     

     

     

    </ClientSettings>

     

     

     

     

     

    </telerik:RadGrid>

     

     

     

     

     

     

    <script type="text/javascript" >

     

     

     

     

     

     

     

    function LoadGridData()

     

    {

     

    var pageSize = $get("<%= ddPageSize.ClientID %>").value;

     

     

    var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

     

     

    var currentPageIndex = tableView.get_currentPageIndex();

     

     

    var sortExpressions = tableView.get_sortExpressions().toString();

     

     

     

    var gridPageSize = tableView.get_pageSize();

     

    PageMethods.GetData(

    "", "", gridPageSize, 1, OnLoadDataSuccess, OnLoadDataFailed);

     

     

    }

     

    function OnLoadDataSuccess(e)

     

    {

     

    var grid = $find("<%= RadGrid1.ClientID %>");

     

     

    if (grid != null)

     

    {

     

    var tableView = grid.get_masterTableView();

     

    tableView.set_dataSource(e.Rows);

    tableView.set_virtualItemCount(e.TotalRowCount); //Here is where the exception is generated. In the debugger

    tableView.dataBind();

    }

    }

Back to Top