How to make datagrid w/ 2 addresses in each row

M

moondaddy

I have a page listing all the addresses for a customer and I want 2
addresses per row. Each address is in a template column so I can add
special formatting and buttons. My problem is that each address is a row of
data made of up many fields (line1, line2, city, state, etc.). So I can
populate the first address in the row's left template, but how do I then go
to the next row of data for the 2nd address while remaining in the 1st row
in the datagrid to populate the right template? And then continue on like
this in the next datagrid row? I know I could write a special stored
procedure that would put 2 addresses on each row of data and call all of the
fields something like this: 1line1, 1line2, 1city, 1state, 2line1, 2line2,
2city, 2state, etc. But to do this I need to create a #temp table in the
stored procedure and use a curser to loop through the data adding 2
addresses to each row of the temp table. This is not a scaleable way of
retrieving data from the server. Surely this must be a common problem with
a more elegant solution?

Any great ideas out there?
 
G

Guest

Can you use a datalist? You can specify horizontal direction and set the number of columns to "snake" however you want, and you can do whatever you need with the templates, buttons, etc

----- moondaddy wrote: ----

I have a page listing all the addresses for a customer and I want
addresses per row. Each address is in a template column so I can ad
special formatting and buttons. My problem is that each address is a row o
data made of up many fields (line1, line2, city, state, etc.). So I ca
populate the first address in the row's left template, but how do I then g
to the next row of data for the 2nd address while remaining in the 1st ro
in the datagrid to populate the right template? And then continue on lik
this in the next datagrid row? I know I could write a special store
procedure that would put 2 addresses on each row of data and call all of th
fields something like this: 1line1, 1line2, 1city, 1state, 2line1, 2line2
2city, 2state, etc. But to do this I need to create a #temp table in th
stored procedure and use a curser to loop through the data adding
addresses to each row of the temp table. This is not a scaleable way o
retrieving data from the server. Surely this must be a common problem wit
a more elegant solution

Any great ideas out there
 
M

moondaddy

Thanks I'll try it. Never did a datalist before and didn't know that.

--
(e-mail address removed)
Bill Borg said:
Can you use a datalist? You can specify horizontal direction and set the
number of columns to "snake" however you want, and you can do whatever you
need with the templates, buttons, etc.
 
S

Steven Cheng[MSFT]

Hi Moondaddy,

Both DataList and Repeater control are suitable for your situation. And in
addition to their customizability , there is also performance concerns
between the Three ASP.NET buildin databind controls. Here are some
reference in MSDN:

#Deciding When to Use the DataGrid, DataList or Repeater
http://msdn.microsoft.com/library/en-us/dnaspp/html/aspnet-whenusedatawebcon
trols.asp?frame=true

#Repeater Web Server Control
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconRepeaterWebControl.a
sp?frame=true

#DataList Web Server Control
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconDataListWebControl.a
sp?frame=true

Hope also helpful. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top