blouckswwu
asked on
How to create a multi column datagrid
I am having a problem figuring out how to create a web page that has a datagrid with 2-3 columns instead of running off the page. For example:
This is currently what I have:
1223 John Doe
2334 Jane Doe
4432 Jack Doe
3348 Joe Doe
What I would like to have:
1223 John Doe 2334 Jane Doe
4432 Jack Doe 3348 Joe Doe
Two columns will work, but would like 3 columns.
I am using Visual Studio 2003 .net with VB to create a ASP.net page.
Thanks for any assistance
This is currently what I have:
1223 John Doe
2334 Jane Doe
4432 Jack Doe
3348 Joe Doe
What I would like to have:
1223 John Doe 2334 Jane Doe
4432 Jack Doe 3348 Joe Doe
Two columns will work, but would like 3 columns.
I am using Visual Studio 2003 .net with VB to create a ASP.net page.
Thanks for any assistance
u want to have a look at some other controls like the datalist or repeater controls for ur requirement as i am not sure u can very easily acheive what u r trying to do using datagrid ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
using john's idea , use this...
<asp:DataList id="dlMul" runat="server" RepeatColumns="2" RepeatDirection="Horizonta l" RepeatLayout="Table">
<ItemTemplate>
<asp:Label ID="lblName" Runat="server"><%# DataBinder.Eval(Container. DataItem, "name") %></asp:Label>
<asp:Label ID="lblNo" Runat="server"><%# DataBinder.Eval(Container. DataItem, "no") %></asp:Label>
</ItemTemplate>
</asp:DataList>
for my own testing i took a small xml file loaded it into a dataset and then used that as my datasource for the datalist...please modify according to your needs...
Private Sub loadDL()
Dim objDS As DataSet
Try
objDS = New DataSet
objDS.ReadXml("C:\exex\DL2 col.xml")
dlMul.DataSource = objDS
dlMul.DataBind()
Catch ex As Exception
Response.Write(ex.Message)
Finally
If Not objDS Is Nothing Then
objDS.Dispose()
objDS = Nothing
End If
End Try
End Sub
Have fun...
Zulu
<asp:DataList id="dlMul" runat="server" RepeatColumns="2" RepeatDirection="Horizonta
<ItemTemplate>
<asp:Label ID="lblName" Runat="server"><%# DataBinder.Eval(Container.
<asp:Label ID="lblNo" Runat="server"><%# DataBinder.Eval(Container.
</ItemTemplate>
</asp:DataList>
for my own testing i took a small xml file loaded it into a dataset and then used that as my datasource for the datalist...please modify according to your needs...
Private Sub loadDL()
Dim objDS As DataSet
Try
objDS = New DataSet
objDS.ReadXml("C:\exex\DL2
dlMul.DataSource = objDS
dlMul.DataBind()
Catch ex As Exception
Response.Write(ex.Message)
Finally
If Not objDS Is Nothing Then
objDS.Dispose()
objDS = Nothing
End If
End Try
End Sub
Have fun...
Zulu
here's the XML is used
<root>
<record>
<name>a</name>
<no>1</no>
</record>
<record>
<name>b</name>
<no>2</no>
</record>
<record>
<name>c</name>
<no>3</no>
</record>
<record>
<name>d</name>
<no>4</no>
</record>
<record>
<name>e</name>
<no>5</no>
</record>
<record>
<name>f</name>
<no>6</no>
</record>
</root>
<root>
<record>
<name>a</name>
<no>1</no>
</record>
<record>
<name>b</name>
<no>2</no>
</record>
<record>
<name>c</name>
<no>3</no>
</record>
<record>
<name>d</name>
<no>4</no>
</record>
<record>
<name>e</name>
<no>5</no>
</record>
<record>
<name>f</name>
<no>6</no>
</record>
</root>
ASKER
Thanks for all the suggestions. I'll try them and let you know how it goes.
Thanks again!
Thanks again!
Aeros