Aligning rows in horizontal datalist

A

Alan Campbell

Hi,

I am developing an application which displays a large number of
columns and a relatively small number of rows so it makes sense to
display them horizontally.
This is straightforward enough but no matter what I try, I can't get
the rows to align horizontally so it is impossible for the user to
scan along each line.

I know that effectively I have a separate table for each row which is
the problem but I can't think of an alternative way to do this.

This is best explained by a small sample -

<<< FORM BELOW >>>
<asp:DataList ID="myDataList" Runat=server RepeatColumns=5>
<ItemTemplate>
<table>
<tr><td><%# Container.DataItem("au_lname") %></td></tr>
<tr><td><%# Container.DataItem("au_id") %></td></tr>
<tr><td><%# Container.DataItem("address") &
Container.DataItem("address") & Container.DataItem("address")
%></td></tr>
</table>
</ItemTemplate>
</asp:DataList>

<<< CODEBEHIND BELOW >>>
Imports System.data
Imports System.data.sqlclient
Public Class test2
Inherits System.Web.UI.Page
Protected WithEvents MyDataList As
System.Web.UI.WebControls.DataList

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New
SqlConnection("server=server;uid=uid;pwd=pwd;database=pubs")
MyCommand = New SqlDataAdapter("select * from Authors",
MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Authors")

MyDataList.DataSource = DS.Tables("Authors").DefaultView
MyDataList.DataBind()
End Sub

End Class




Also, has anyone got any idea how to display "headings" on the left
hand side and even better - allow the data to scroll while the
"headings" stay fixed - something like freezing panes in Excel?.

Any help you can give is greatly appreciated!.

Alan.
 
A

Alan Campbell

Hi,

OK - just in case anyone googles for this.
I ended up writing some code to swap the rows for columns in the
datatable and then displaying this in a grid. A couple of issues to
workaround with data types but otherwise it works. Luckily I am only
displaying and not editing.

Not as nice as I would have liked and I can't do anything clever
client side but at least it now displays in a useable way.

Row "headings" were simply achived by adding a new row to the data
before swapping the rows and the columns but fixing this (now column)
so that it doesn't scroll with the datagrid is still a mystery but not
too important.

Alan.

(e-mail address removed) (Alan Campbell) wrote in message

<snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top