What"s the best practice to achieve this?
am 08.01.2008 05:04:23 von gnewsgroup
I am not sure how to describe such hanging(?) tables in English
language. But, the following picture shows it clearly.
http://farm3.static.flickr.com/2223/2176441194_37ee1f9ca7_o. png
Normally, it is pretty easy to write a sql that gives us the table
shown at the top of the image. In the web form, we quite often would
like to present it as shown at the bottom of the image.
What's the *easiest* way to do?
I have done this by simply constructing the table through spitting
out
blah blah | blah blah |
.
Better yet (not shown in the image), add one additional line for each
customer to display his/her order subtotal.
I guess there might be easier ways to achieve the same result, either
in the database layer or in the application layer.
Any idea?
Re: What"s the best practice to achieve this?
am 08.01.2008 09:46:09 von Eliyahu Goldin
Use the repeater control. Make the ItemTemplate out of 2 rows:
Binding expression for column 1 |
Binding expression for column 2 |
Binding expression for column 3 |
Subtotal for user
/> is
|
Make the HeaderTemplate as and the FooterTemplate as
.
Handle the PreRender event to loop through the repeater items to show user
names only in the first trData rows for the same user. That is easily
controllable with the Visible property.
In the same loop detect the last item for every user and make the trSubtotal
row visible. Hide it for all other items. Again, do it with the Visible
property for the row.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"gnewsgroup" wrote in message
news:53f72477-6b2f-4786-b1b9-f03250337d9f@n20g2000hsh.google groups.com...
>I am not sure how to describe such hanging(?) tables in English
> language. But, the following picture shows it clearly.
>
> http://farm3.static.flickr.com/2223/2176441194_37ee1f9ca7_o. png
>
> Normally, it is pretty easy to write a sql that gives us the table
> shown at the top of the image. In the web form, we quite often would
> like to present it as shown at the bottom of the image.
>
> What's the *easiest* way to do?
>
> I have done this by simply constructing the table through spitting
> out
>
> blah blah | blah blah |
.
>
> Better yet (not shown in the image), add one additional line for each
> customer to display his/her order subtotal.
>
> I guess there might be easier ways to achieve the same result, either
> in the database layer or in the application layer.
>
> Any idea?
Re: What"s the best practice to achieve this?
am 08.01.2008 15:02:44 von gnewsgroup
On Jan 8, 3:46 am, "Eliyahu Goldin"
wrote:
> Use the repeater control. Make the ItemTemplate out of 2 rows:
>
>
> Binding expression for column 1 |
> Binding expression for column 2 |
> Binding expression for column 3 |
>
>
> Subtotal for user
> /> is
> |
>
>
> Make the HeaderTemplate as and the FooterTemplate as
.
>
> Handle the PreRender event to loop through the repeater items to show user
> names only in the first trData rows for the same user. That is easily
> controllable with the Visible property.
>
> In the same loop detect the last item for every user and make the trSubtotal
> row visible. Hide it for all other items. Again, do it with the Visible
> property for the row.
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
Thank you. I thought about Repeater control, too. But I didn't know
how to hide any cell. Now that you say that this can be done through
handling PreRender, I am gonna look into it.
Guess what, I have never handled the PreRender event. Not sure how to
do it.
Re: What"s the best practice to achieve this?
am 08.01.2008 18:59:04 von SteveT
On Jan 8, 9:02 am, gnewsgroup wrote:
> On Jan 8, 3:46 am, "Eliyahu Goldin"
>
>
>
> wrote:
> > Use the repeater control. Make the ItemTemplate out of 2 rows:
>
> >
> > Binding expression for column 1 |
> > Binding expression for column 2 |
> > Binding expression for column 3 |
> >
> >
> > Subtotal for user
> > /> is
> > |
> >
>
> > Make the HeaderTemplate as and the FooterTemplate as
.
>
> > Handle the PreRender event to loop through the repeater items to show user
> > names only in the first trData rows for the same user. That is easily
> > controllable with the Visible property.
>
> > In the same loop detect the last item for every user and make the trSubtotal
> > row visible. Hide it for all other items. Again, do it with the Visible
> > property for the row.
>
> > --
> > Eliyahu Goldin,
> > Software Developer
> > Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
>
> Thank you. I thought about Repeater control, too. But I didn't know
> how to hide any cell. Now that you say that this can be done through
> handling PreRender, I am gonna look into it.
>
> Guess what, I have never handled the PreRender event. Not sure how to
> do it.
Or, if you want some help with this, check this link:
http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm