Adding line break in repeater output.


I am using a repeater to output a set of images defined with a sql db.  I would like to output 4 images in a row and then add a line break.  I have tried various methods and miserably failed.  Any help appreciated.



5/5/2009 4:03:23 AM 72751 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 54


In repeater you will not be able to assign Repeate Columns. So for that you can use datalist and assign the RepeatColumns="4", RepeatDirection="Horizontal" properties to it.

This will solve your problem.

Kalpana Patel

Remember to click "Mark as Answer" on the post, if it helps you.
5/5/2009 4:27:35 AM

Havn't got time to test this out but I would set up something like this

<asp:Repeater ID="rep" runat="server" onitemcommand="rep_ItemCommand" >


             <img src="<%# DataBinder.Eval(Container.DataItem,"Image") %>" />



 In the code behind you want to do something like this:

 protected void rep_ItemCommand(object source, RepeaterCommandEventArgs e)



    Math.DivRem(counter,4,out result);

    if (result == 0)


         HtmlGenericControl ctrl = new HtmlGenericControl("<br />");





Let me know if this helps.  You can obviously get more elaborate than this as far as formatting is concerned.



Plz remember to click "Mark as Answer" if this helped you.
5/5/2009 4:38:47 AM


this code will helps you..

<asp:Repeater ID="RptWater" runat="server"



<asp:CheckBox ID="chkWater" runat="server" />

<asp:Label ID="LblWater" runat="server" Font-Names="Verdana" Font-Size="11px"

Text='<%# Bind("EDDCOlumnName") %>'></asp:Label>

<asp:Label ID="lblBreakWater" runat="server" Text="&lt;br/&gt;" Visible="false"></asp:Label>




now in your code file in item databound event of repeater..

protected void RptWater_ItemDataBound(object sender, RepeaterItemEventArgs e)


int Align = (e.Item.ItemIndex % 4);if (Align == 0 && e.Item.ItemIndex > 0)


"lblBreakWater").Visible = true;




"lblBreakWater").Visible = false;




Hope this helps..

(please mark as an answer, if this helps you.)
5/5/2009 4:45:20 AM

Similar Artilces:

User Controls adding line breaks
 I have a user control with a place holder inside it. The place holder is working fine but the user control it's in seems to be adding a line that I can't get rid of. Here's a screenie:  See that one white line after the gray area has ended? I never put that there and it's not selectable. My code doesn't have the line break in it: <div id="box">    <div id="lb">        <div id="rb">            <div id="b...

Inserting Line Breaks in Data Presentation Controls?
Hi there, I have News Stories stored in an SQL database, and I'd like to display a summary of the News Stories on my home page like this (with a new line for each field in the summary): News Headline 1News Summary 1Date 1Link 1 News Headline 2News Summary 2Date 2Link 2 News Headline 3News Summary 3Date 3Link 3 ...etc... News Headline 10News Summary 10Date 10Link 10 Can this be done by manipulating a GridView at all?  Or can anyone recommend the most effective way of doing this? Any help would be greatly appreciated - as you can probably tell, I'm still in newbie territory... Be...

Multiline Textbox Input not showing line breaks in Repeater Control
Hi, My problem relates to saving data in a database using text boxes, and then displaying them with their correct formating using a repeater control. The following code relates to a simplified version of the actual page where i am having the problem, but the same problem occurs in the following example.<body> <form id="form1" runat="server"> <div> Add Title: <asp:TextBox ID="TitleTextBox" runat="server"></asp:TextBox> <br /> Add Description: <asp:TextBox ID="Descript...

Line break or not to line break
Gurus, thx in advance. I'm a sysadmin gone mad (NEWB Coder) What I am trying to do will be simple sor one of you guys. I have the book titled Build Your Own 2.0 WebSite using c# & VB from which I am trying to learn .net / VWD . The snippet of code that follows will help me explain my issue. <script runat="server" language="VB"> Sub Click(ByVal s As Object, ByVal e As EventArgs) Dim i As Integer feedbackLabel.Text = "Your name is: " & name.Value & "<br />" feedbackLabel.Text += "Your email is: " &...

Adding a Label control inside a Repeater control
I am editing a web application that is accessed by customers in 3 different countries.  As such, the text on the website is different depending on what country it is accessed from. The way I have implemented this, is that I have one aspx page.  All the text that is consistent across all countries is typed directly into this page.  However, the text that changes is placed in <asp:label> tags, and we determine what text is to be displayed at runtime I have run into an issue though, because some of the "dynamic" text needs to be placed inside an <asp:repeater> contr...

Adding Event Handler to Child Control in Repeater Control
I have a user control which has links buttons as children controls. I use this control to show the parent and child data.<asp:Repeater id="Repeater" runat="server" OnItemDataBound="Repeater_ItemDataBound"> <ItemTemplate> <asp:Panel id="Panel" runat="server"> <asp:Label id="Name" runat="server" Font-Bold></asp:Label> <div class="Small"> <asp:Panel id="EditPanel" runat="server"> <asp:Label ID="lblids" runat="server" Visible...

Repeater control in another repeater control
Hi, I want Repeater control in another repeater control but it is not working Code : <asp:Repeater ID=CourseMaster Runat=server > <ItemTemplate> <table border=0 cellpadding=0 cellspacing=0 style="font-family:tahoma;font-size:12"> <tr> <td >&nbsp;<b</b></td> </tr> <tr> <td> <asp:repeater ID="CourseDetails" Runat=server> <ItemTemplate> <tab...

Adding a dynamic reference to an image control from a repeater control
Hi  I'm using a repeater control, and within it I have an image control. I want to set the imageUrl property of the image control to a reference from the repeater - I hope I'm explaining this right! ;)  This is what I've tried (to help illustrate), but alas, it's not working :( <asp:Image ID="Image1" runat="server" ImageUrl="~/images/<%#DataBinder.Eval(Container.DataItem, "productImage")%>.gif" /> Thanks for any helpRichard Try <asp:Image ID="Image1" runat="server" ImageUrl='~/image...

Line breaks in output.
When I use "\n" to create a line break in output, I end up with a double space. For example, the following code...myMessage.Body = "Requestor: " + requestor + "\n"; myMessage.Body += "Requestor Email: " + requestorEmail; Results in something like... Requestor: Name Requestor Email: I would rather see... Requestor: NameRequestor Email: Is there a different escape character I need to be using?"Here's where the fun begins." -- Han Solo Are you using Text or HTML output?if you are using HTML for you...

Line Break Control
I've been unable to figure this one out myself and my searches haven't helped at all, I am simply trying to programmatically add line breaks to my page. Using: div1.Controls.Add(New HtmlGenericControl("br")) works, but adds the line break twice for each instance which looks pretty bad. How can I add a simple line break to a Panel object? These forms I'm creating are fairly complex so writing direct HTML, ie something like Response.write("<br />") isn't going to help much. Thanks for the help, -nomad311 You must be executing that sentence twice...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

Repeat a Repeater Control?
I have a stored procedure that returns one big table with Employee names, phone numbers, and their state.  I need to generate different tables (or GridViews, or Repeaters... not sure) for each state.  Here's an example: My table hasID     Employee_Name    Phone_Number     State I need my web form to look like this: CaliforniaID    Employee_Name   Phone_NumberID    Employee_Name   Phone_NumberID    Employee_Name   Phone_Num...

Adding an imageButton in a repeater control
Hi, I have a data repeater on my page which has a column where I want to add a delete button. This is an imageButton. On clicking this button that particular row is to be deleted from the database. This will require a postback. And I need value of some other column in the dataset while deleting the row. How do I call some server-side function "DeleteRow()" on click of the imageButton? How do I pass some parameter to this function which is a value from some column, say "RowId", in the dataset, which is the PK of the table in DB? Thanks in advance. Set the...

New .Net Controls Added
www.TechnicalVideos.Net is now offering new .Net Controls for you to download free with the purchase of a 3 month or longer subscription to our site. So for $19.99 you will now get over 125 videos along with .Net controls and their source code. www.TechnicalVideos.Net ...

Web resources about - Adding line break in repeater output. -

Repeaters - Wikipedia, the free encyclopedia
Kyle Halsted, Sonia Logan, and Michael Weeks are inmates at a rehabilitation facility. Bob Simpson, the administrator, tasks them with apologizing ...

Repeater Locator on the App Store on iTunes
Get Repeater Locator on the App Store. See screenshots and ratings, and read customer reviews.

Consumers warned to beware of illegal mobile phone repeaters
Use of devices sold online as legitimate solution is in fact dangerous and can land you in jail, regulator warns.

Grim repeater: HIV on the rise
CANDLES flicker in the chilly night air as Jesse Hooper appears on the giant cinema screen overlooking Melbourne&#8217;s Federation Square. He&#8217;s ...

Telstra suspects underbelly of illegal repeaters
'Tens' busted each year. Telstra engineers suspect a "vast" undercurrent of illegal repeaters are causing issues for the carrier's Next G mobile ...

Hands on: Cel-Fi mobile repeater
If your home is a mobile blackspot then a Cel-Fi mobile repeater might help you stay connected.

Amped Wireless R20000G, SR20000G, and UA2000: Routers, Repeaters, and Adapters
... and throughput when pointed at your wireless router/access point. Rounding out the review, Amped sent a third product, their SR20000G repeater, ...

Extending your network's range with a wireless repeater
... your cable modem has to live on one end of your house, leaving the other far away from your wireless signal. That's where a wireless repeater ...

Brooke Mueller, Lindsay Lohan, Demi Moore: Celebrity Rehab Repeaters (PHOTOS)
Brooke Mueller is off the wagon again, shockingly returning to rehab for the 19th time. Although that number is extreme, rehab has unfortunately ...

Computer networking: wireless networks (wifi), routers, repeaters & more - CNET Reviews
Computer networking reviews and ratings, video reviews, user opinions, most popular network hardware, wireless network buying guides, prices, ...

Resources last updated: 1/23/2016 11:04:56 AM