RadGridView lines Count

3 posts, 0 answers
  1. Ala eddine
    Ala eddine avatar
    19 posts
    Member since:
    Feb 2012

    Posted 04 May 2012 Link to this post

    could not count lines in RadGridView
    i used this code :
    _________________________________________

    var query = from m in _Context.Modules

                  select m;

     

    var count = query.Count();

    radGridView1.ItemsSource = query;

    label1.Content = count;

    __________________________________________

    label1 shows 0 even where radGridView1 has some items 

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 May 2012 Link to this post

    Hello Ala eddine Boukhris,

    You need to execute the query and make sure that the items are loaded. Then you can work directly with Items collection of the grid and get its count (this.myGrid.Items.Count).   

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Ala eddine
    Ala eddine avatar
    19 posts
    Member since:
    Feb 2012

    Posted 04 May 2012 Link to this post

    i tryed again with this code
    ___________________________
     

    ModuleContext _context = new ModuleContext();

    radGridView1.ItemsSource = _context.Modules;

    LoadOperation<Module> op = _context.Load(_context.GetModulesQuery());

    i used
    label1.Content = op.Entities.Count();
    and
    label1.Content = radGridView1.Items.Count;

    but i have 0 shown evrytime!!!

Back to Top