Click here to Skip to main content
15,887,285 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have list to bind and inside of list there is another list. In inner list I want to format only 5 repetition after 5 they will go to the next row. And I have a code for that in Row Groups
=Fields.RowNum/5 

above code snippet works fine if there is ony one list. But within nested list it shows error
The error has been occurred while processing Table "list2" The expression contains object "RowNum" that is not defined in the current context 

cause of error is:
I am providing a list for 1st list and there is another list inside that list. So, it's not readable while binding the report.

C#
DataTable dt = dal.ReturnSQLDataTable(sql);

 List<Area> lstItems = new List<Area>();
 if (dt != null && dt.Rows.Count > 0)
 {
     lstItems = (from DataRow dr in dt.Rows
                 select new Area()
                 {
                     area_id = Convert.ToString(dr["area_id"]),
                     area_name = Convert.ToString(dr["area_name"]),
                     Rooms = GetAreaItem(Convert.ToString(dr["area_id"]),item_id) //this is another list here i am proving list of area
                 }).ToList();

 }
 this.list1.DataSource = lstItems;


So, how will I bind or read that RowNum form list dynamically to bind exact nested data with below expression
=Fields.RowNum/5 

I have modified it as and try to read it's 1st index like below code snippet
=Fields.Rooms[0].RowNum/5 

but still got error
An error has been occurred while processing Table "list2":Missing operator before "[0]" operand


if anyone have any idea to modify the expression please help.

Thanks

What I have tried:

=Fields.RowNum/5


=Fields.Rooms[0].RowNum/5
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900