?
Solved

adding a separatortemplate that occurs after every 3 itemtemplate content has been displayed

Posted on 2011-04-19
3
Medium Priority
?
684 Views
Last Modified: 2012-05-11
I have a nested repeater control. I need to display 3 divs in the outer repeater control in each row. hence after 3 of these are displayed from left to right, I want to add a <br /> so that content will be displayed in the next row at the same vertical heigh. Can I add a <br /> somehow after 3 itemtemplate content . is there a way to specify at design time may be using separatortemplate or some other way? i am attaching the code I have thanks please help

in the attached code, after 3 panels named parentdiv I would like to attachch a line break. thanks



 <asp:Repeater ID="rptCat" Runat="server">  
                        <ItemTemplate>      
                                <asp:Panel ID="parentDiv" runat="server">
                                       <h4> <a href= "<%# DataBinder.Eval(Container.DataItem, "CategoryUrl") %>" >
                                                  <%# DataBinder.Eval(Container.DataItem, "Category2Name")%>  </a>  </h4>
                                  <asp:Repeater ID="rptSubCat" runat="server">                                    
                                        <ItemTemplate>  
                                               <ul style="list-style-type:disc; color:#2D3F75;margin-left:-15px;">
                                            <li style="line-height:1em; margin-top:-9px;margin-left:-12px;">
                                                 <a style="color:#1D3a6c; font-weight:normal;font-size:1em;" href= "<%# DataBinder.Eval(Container.DataItem, "CategoryUrl") %>" >
                                                 <%# DataBinder.Eval(Container.DataItem, "Category3Name")%></a>  <br />
                                                                                           
                                            </li>
                                            </ul>
                                       </ItemTemplate>      
                                           
                                   </asp:Repeater>                  
                       
                                    </asp:Panel>                    
                        </ItemTemplate>  
                                         
                    </asp:Repeater>
0
Comment
Question by:TrialUser
  • 2
3 Comments
 
LVL 61

Expert Comment

by:HainKurt
ID: 35429894
if you can add a number to your recordset, it would be easier...
or something like this may work...

put a <br runat=server visible="<%=isVisible()%>">

where isVisible is a public/friend function like this

private n as int =0
public function isVisible() as boolean
  n=n+1
  return (n mod 3)=0
end function
0
 

Author Comment

by:TrialUser
ID: 35429961
would the isfunction code be in the server side ?
 also where would i add the <br > :

 <asp:Repeater ID="rptCat" Runat="server" > 
                        <ItemTemplate>      
                       
                               <div class="divParentCat2temp">
                                       <h4> <a href= "<%# DataBinder.Eval(Container.DataItem, "CategoryUrl") %>" >
                                                  <%# DataBinder.Eval(Container.DataItem, "Category2Name")%>  </a>  </h4>
                                  <asp:Repeater ID="rptSubCat" runat="server">                                    
                                        <ItemTemplate>  
                                               <ul style="list-style-type:disc; color:#2D3F75;margin-left:-15px;">
                                            <li style="line-height:1em; margin-top:-9px;margin-left:-12px;">
                                                 <a style="color:#1D3a6c; font-weight:normal;font-size:1em;" href= "<%# DataBinder.Eval(Container.DataItem, "CategoryUrl") %>" >
                                                 <%# DataBinder.Eval(Container.DataItem, "Category3Name")%></a>
                                                                                           
                                            </li>
                                            </ul>
                                       </ItemTemplate>                                  
                                           
                                   </asp:Repeater>  
                                    </div>                                      
                                              <br runat="server" visible="<%=isVisible() %">
                        </ItemTemplate>  
                                         
                    </asp:Repeater>
0
 
LVL 61

Accepted Solution

by:
HainKurt earned 2000 total points
ID: 35429988
isVisible will be in the server side... and the location of code looks correct to me

<br runat="server" visible="<%=isVisible() %">

just write that function and put into code behind and test it...
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question