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

Error collapsing a Grid Row

3 Answers 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 04 Jul 2010, 12:55 AM
I have a grid with a MasterTable and a DetailsTable.

If I expand a row on the MasterTable I can, as you would expact, collapse it again.

If, however, I select a row in the DetailTable and then try and collapse the MasterTable row, I get the following JScript error (in IE8)...
"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Collection was modified; enumeration operation may not execute."

I haven't got any client-side script of my own so it's nothing I've done (at least, not knowingly).

FWIW, the error is reported 62,099 characters in to line 6 of MicrosoftAjax.js.

Anyone any ideas why?

-- 
Stuart

3 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 04 Jul 2010, 09:35 AM
OK. It is something I'm doing but I don't know why it's a problem. I've wired up the OnPreRender event of the page and it reads...
gdSchools.SelectedIndexes.Clear(); 
if (gdSchools.Items.Count != 0) 
  if (currentRow.DetailTableIndex == -1) 
  { 
    gdSchools.SelectedIndexes.Add(currentRow.MasterTableRowIndex); 
  } 
  else 
  { 
    gdSchools.SelectedIndexes.Add(currentRow.MasterTableRowIndex, currentRow.DetailTableIndex, currentRow.DetailTableRowIndex); 
  } 

Where "currentRow" is an object containing a number of integer values.

The thing is, if I comment out the lines adding elements to the SelectedIndexes collection, or more specifically, the latter addition, it works.

So, I guess there are 2 questions:
  1. Is there another way to highlight a grid row, specifically in a DetailTable?
  2. If the answer to (1) is no, is it possible to use manipulation the SelectedIndexes collection to highlight a DetailTable row which will still allow the user the collapse the MasterTable row without generating an error?

-- 
Stuart
0
Tsvetina
Telerik team
answered on 07 Jul 2010, 03:49 PM
Hello Stuart,

I tested the project you sent me in the support ticket post, and saw that you have fixed this problem by calling the methods which populate your grid, after selecting the indexes. However, to avoid duplicate posts, we can continue our communication in the support ticket you have opened.

Kind regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart Hemming
Top achievements
Rank 2
answered on 07 Jul 2010, 03:51 PM
However, to avoid duplicate posts, we can continue our communication in the support ticket you have opened.
That's great. 

In appropriate, I'll copy the solution here when we're done.

-- 
Stuart
Tags
Grid
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Tsvetina
Telerik team
Share this question
or