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

RadGridView lines Count

2 Answers 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ala eddine
Top achievements
Rank 1
Ala eddine asked on 04 May 2012, 08:36 AM
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 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 04 May 2012, 08:42 AM
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 >>

0
Ala eddine
Top achievements
Rank 1
answered on 04 May 2012, 09:38 AM
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!!!

Tags
GridView
Asked by
Ala eddine
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ala eddine
Top achievements
Rank 1
Share this question
or