Solved

flow layout issue with datalist

Posted on 2007-11-27
3
1,643 Views
Last Modified: 2012-06-21
hi there,
I have tried using the repeatlayout using the flow option although it seems to insert a line break after each element.  The code segment produces the following html.
               
                <span id="myfavourites"><span>
                    <div class="fav-box">
                        <img src="" alt="" />
                        <div class="fav-title">
                            test video
                        </div>
                        <div class="fav-content">
                           
                        </div>
                    </div>

                </span><br /><span>
                    <div class="fav-box">
                        <img src="/x" alt="" />
                        <div class="fav-title">
                           dsa
                        </div>
                        <div class="fav-content">
                            dsa
                        </div>
                    </div>

                </span><br /><span>


As you can see the last line for each record </span><br /><span> which I dont want.  Can this be removed?  Or can I use a different asp control to get around this?  

Many thanks

<asp:DataList ID="myfavourites" runat="server" RepeatLayout="Flow">

                <ItemTemplate>

                    <div class="fav-box">

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

                        <div class="fav-title">

                            <%# DataBinder.Eval(Container.DataItem, "") %>

                        </div>

                        <div class="fav-content">

                            <%# DataBinder.Eval(Container.DataItem, "") %>

                        </div>

                    </div>

                </ItemTemplate>

                </asp:DataList>

Open in new window

0
Comment
Question by:jimbona27
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
joex911 earned 400 total points
ID: 20359870
Hi, set the following properties in your DataList:

RepeatDirection="Horizontal"
RepeatColumns="# of items in your datasource"

I think that should do the trick.
0
 

Author Comment

by:jimbona27
ID: 20364229
thanks great stuff
0
 

Author Comment

by:jimbona27
ID: 20451419
in the rendered html .net creates the following

                    <ul>

                        <span id="ctl07_TopNav_DataList"><span>
                            <li>xxx</li>
                        </span><span>
                            <li>xxx</li>
                        </span><span>
                            <li>xxx</li>
                        </span></span>

                    </ul>


any ideas how I can remove the
                        "<span id="ctl07_TopNav_DataList"><span>"

it brakes my validation with w3c!
argh!

thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now