Solved

Rows to Columns

Posted on 2009-07-03
3
192 Views
Last Modified: 2012-05-07
Hello:

I am trying to display this field into 3 columns instead of one long column.

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" ShowHeader="False" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="ID"  />
           </Columns>
</asp:GridView>

0
Comment
Question by:RecipeDan
3 Comments
 
LVL 12

Expert Comment

by:Cyber-spy
ID: 24774218
You are trying to split the 'ID' field across 3 columns, instead of one? Is this correct?

What is the format of your ID field? Can you give an example here?
0
 
LVL 1

Author Comment

by:RecipeDan
ID: 24774257
Yes that is correct. ID is a text field. The ID column looks like this:

ID
Dan
Matt
John
Andy
Rohger
Sara
Bill
Bob

I want it to look like this:
Dan                    Matt               John
Andy                  Roger           Sara
Bill                      Bob

0
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 24774516
try using DataList control like below.
Note the property: RepeatColumns="3
 <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1"
        RepeatColumns="3">
        <ItemTemplate>
            <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("ID") %>' />
        </ItemTemplate>
    </asp:DataList>

Instead of lable you can use li tags as well or any other kind of appropriate control
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 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