Unable to interact with object collections in a list...
Posted: Wed Jul 23, 2014 9:51 pm
I'm having trouble understanding why this won't work. Conceptually it seems ok, but in practice it does not.
Here is the code:
The above is the start of the for loop. For the FIRST row in the collection "rowData" will be populated with all the data cells (TD) correctly, however when we move to the next iteration (i.e. row 2), then it will never find any children. It's like I have to redo this:
var dataRows = allPaymentsObjects.GridData.Self.FindChildren<TrTag>()
Even though it should already contain all the rows. Somehow it lost the row information. Am I missing something here? I can't just keep getting the dataRows over and over because it will change my iteration (well I could do it in another way, but the above is ideal). Thanks!
Here is the code:
Code: Select all
var allPaymentsObjects = FileUploadSummaryRepository.Instance.UploadSummary.PaymentTabs.AllPayments;
//This returns a collection of rows which I will iterate through...
var dataRows = allPaymentsObjects.GridData.Self.FindChildren<TrTag>();
foreach (var dataRow in dataRows)
{
FileUploadSummaryRepository.Instance.LineItemNumber = counter.ToString();
var rowData = dataRow.FindChildren<TdTag>()
var dataRows = allPaymentsObjects.GridData.Self.FindChildren<TrTag>()
Even though it should already contain all the rows. Somehow it lost the row information. Am I missing something here? I can't just keep getting the dataRows over and over because it will change my iteration (well I could do it in another way, but the above is ideal). Thanks!