Solved

flow layout issue with datalist

Posted on 2007-11-27
3
1,660 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:
Oliver Amaya 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

749 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