Solved

flow layout issue with datalist

Posted on 2007-11-27
3
1,650 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

896 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

15 Experts available now in Live!

Get 1:1 Help Now