Click here to Skip to main content
11,412,833 members (72,781 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET SQL Server
Hello All,

I have a little problem with datalist.
I have a datalist that display data from sql server.
datalist display records from top to down direction.
but i want datalist display records from left to right(only in one row).(Example 1,2,3,4,5,6,7,8,9.........................n nubmer)

i am using this code..

<asp:DataList ID="DataList1" runat="server" CellPadding="4" RepeatLayout="Flow" DataSourceID="SqlDataSource1"
                           ForeColor="#333333" Width="300px" RepeatColumns="2" RepeatDirection="Horizontal">
                           <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                           <FooterStyle Font-Bold="True" ForeColor="White" BackColor="#5D7B9D" />
                           <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#5D7B9D" />
                           <ItemStyle ForeColor="#333333" BackColor="#F7F6F3" />
                           <ItemTemplate>
                               <a class='iframe' href="business-plans.aspx?nm='<%# Eval("Name") %>'">



<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyArea %>"
               SelectCommand="src_tbl" SelectCommandType="StoredProcedure">
           </asp:SqlDataSource>
Posted 24-Apr-13 20:38pm
Comments
patel_vijay at 25-Apr-13 7:04am
   
Dont use DataList Use Repeater control
BALBINDER4u at 26-Apr-13 4:15am
   
Why ?
Please tell me the reason .
chien.vh at 4-May-13 14:55pm
   
You can use both of DataList and Repeater to do that.
So, after looking at your code, it seems work fine. However, pls try to remove some code and use below code for your testing.

<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal">
<itemtemplate>
//Code here
</itemtemplate>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 404
1 Sascha Lefévre 200
2 Maciej Los 150
3 ProgramFOX 130
4 Sergey Alexandrovich Kryukov 110
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,317
2 Maciej Los 3,570
3 Abhinav S 3,298
4 Peter Leow 3,084


Advertise | Privacy | Mobile
Web03 | 2.8.150427.1 | Last Updated 25 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100