Solved

flow layout issue with datalist

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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‚Ķ
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

776 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