Click here to Skip to main content
15,122,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello can any one tell me that ..!
I retrieve a single column data from sql server horizontaly in a row.
i wana do that after five values in a row it's automatically created second(another) row for 6,7,8,9,10 value.
and then third row for 11,12,13,14,15 values. and up to so on..
please give me it's example code . ..
the code is given below :
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource3" 
                        RepeatDirection="Horizontal" CssClass="cll_bg" ShowFooter="False" ShowHeader="False" GridLines="Both">
                        <table style="height:48px">
                            <tr><td align="center" title="days here" style="height:18px; width:16px"><%# Eval("days") %></td></tr>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:BRIDGES_DBConnectionString %>" 
                        SelectCommand="SELECT [month] FROM [tbl_calendar_days]">
Updated 31-Aug-12 9:11am
[no name] 31-Aug-12 12:47pm
You are going to have to be more specific with what it is that you want to do, including the code that you have tried but is not working like you would like it to work.
Member 8911636 31-Aug-12 13:34pm
i have given it's code...
i wana get it in an other row after 5 values
Prabhakaran Soundarapandian 31-Aug-12 12:56pm
Can you improve your question...

1 solution

You might be able to pull this one off with a GridView control directly, or make a dataTable dynamically and then set the table as the gridviews data source. This would be the general idea...

declare a dataTable
declare a data row

while (reading Database)
     for (int i=0; i < 5; i++)
        //add cell to dataRow until we hit 5
     //add the data row to the dataTable and start over until end of database.


There are a lot of examples floating around on dynamically adding rows to a data table out there that might be able to help

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900