Solved

Rows to Columns

Posted on 2009-07-03
3
191 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now