Hierarchical Viewer or Nested Repeater

uzair Ahmed asked on May 10, 2018 09:30

HELLO TEAM, i have a tough Situation here. Please Help.

Well, I have multiple table that i want to show on page, that tables are populating through Custom Documents. Problem is that i have Multiple Data in a table. ok lets have a look in a sequence:-

1- code will execute from < table> till < tbody> < tr> ///// Repeater 1

2-Now from here another repeater should call and all the rows fetch from Document2. < td> < /td> ////Repeater 2

3-after that it will execute < /tr> < /tbody> ///// Repeater 1

4- now repeat that process untill Repeater1 can't get All data in Document1

< div class="table-responsive">

                                    <table class="table table-striped">
                                        <caption>Gear: <%# Eval("GearType") %></caption>
                                        <thead>
                                          <tr>

                                                <th>Name</th>
                                                <th>Length(m)</th>
                                                <th> Hold Volume</th>
                                                <th>Carrying Capacity(t)</th>
                                                <th>Notes</th>
                                            </tr>
                                        </thead>
                                        <tbody>

                                               <tr> // This Has to repeat and get the data from another                                      //Custom Document... 
                                                 <td><%# Eval(" Name") %></td>       
                                                 <td><%# Eval("Length") %></td>                 
                                                 <td><%# Eval("HoldVolume") %></td>
                                                 <td><%# Eval("CarryingCapacity") %></td>
                                                 <td><%# Eval("Notes") %></td>
                                               </tr>
                                            </tbody>
                                    </table>

Recent Answers


Jan Hermann answered on May 10, 2018 12:44

It depends if those pages/documents are in some hierarchy to each other. IF yes, then the hierarchical viewer is way better choice, since it much cleaner solution. If not I would consider to use the Repeater with custom query or a custom web part instead. With this you can lower the number of DB calls, so nested repeaters should be the last option here.

0 votesVote for this answer Mark as a Correct answer

uzair Ahmed answered on May 10, 2018 13:00

documents are not Hierarchical , both are different.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 10, 2018 17:26

Can you share your data structure?

Secondly, is the data pages data or custom table or module data?

Lastly, is there a relationship between the GearType and the Gear?

0 votesVote for this answer Mark as a Correct answer

uzair Ahmed answered on May 10, 2018 20:46 (last edited on May 10, 2018 20:48)

Hi, There is no any Relationship B/w Two Custom Documents.

Gear have some different Content in Document1 . and repeater will fetch that content from Document1,

And data is Just Page that contain Content only PageType. actually i want to use repeater within a repeater.

When PageLoad its Should work like this :-

Have a look On flow:

1st Cycle/Rotation - Repeater 1

1st Cycle - Repeater 2, 2nd Cycle - Repeater 2, 3rd Cycle - Repeater 2 4th Cycle - Repeater 2, and so on.until documents ain't finished ..

1st Cycle- Repeater-1

--

2nd Cycle - Repeater 1

1st Cycle - Repeater 2, 2nd Cycle - Repeater 2, 3rd Cycle - Repeater 2 4th Cycle - Repeater 2, and so on. until documents ain't finshed.

2nd Cycle- Repeater-1 ..... and so on ......

0 votesVote for this answer Mark as a Correct answer

uzair Ahmed answered on May 10, 2018 20:57

Here is the Example

for(num2 = 0; num2 <= 3; num2++) //outer LOOP

{

  for(num1 = 0; num1 <= 2; num1++)   //Inner LOOP
  {
        cout<< num2<< "   " << num1<< endl;     
  }

}

Thats All i want.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 10, 2018 21:10

If there is no relationship between the two records, then how to you plan to get the right gears for the specific type? Or all of the gears will show for all of the types? Typically there is a relationship between them somehow. Even if it is in the content tree like so:

/gear-type-1/gear-1
/gear-type-1/gear-2
/gear-type-2/gear-1

What is the structure of your data?

0 votesVote for this answer Mark as a Correct answer

uzair Ahmed answered on May 10, 2018 21:17

Yes Good Question But we can handle after setting Repeaters, We can just use Query Where Gear=Longline then fetch only longline records , first priority to get data with repeaters or nested repeater. and yes it all gear can contain all data for now, after that i will fix it using Query or Macro expressions. what do you say?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 10, 2018 21:25

You can definately use a nested repeater (not recommended) but if you share the strucuture of what your content looks like OR the structure of your data, then I can provide an exact solution for you. The problem is if you don't know the structure of your data then it's hard to help you.

Example:

Gear Type:
GearTypeID: 1 (primary key)
Name: Longline

GearTypeID: 2 (primary key)
Name: Shortline

Gear:
GearID: 101 (primary key)
GearName: Gear One
GearTypeID: 1 (foreign key)

GearID: 102 (primary key)
GearName: Gear Two
GearTypeID: 1 (foreign key)

GearID: 103 (primary key)
GearName: Gear Three
GearTypeID: 2 (foreign key)

1 votesVote for this answer Mark as a Correct answer

uzair Ahmed answered on May 11, 2018 08:50 (last edited on May 11, 2018 08:50)

https://www.screencast.com/t/pDFvsSfriW

Please Have A look on this Screenshot. This is just an example .

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.