Please HELP ...........DataGrid

  • Thread starter Thread starter kelvinweb
  • Start date Start date
K

kelvinweb

Hi All,

I don't know how to using datagrid to display data in the following.


OrderNo OrderDate TotalQty TotalAmount
-------- --------- -------- -----------
- 889999 10Oct2005 5 2,000,000

ItemName
 
Hi All,

I don't know how to using datagrid to display data in the following.


OrderNo OrderDate TotalQty TotalAmount
-------- --------- -------- -----------
- 889999 10Oct2005 5 2,000,000

ItemName
---------
Item A 3 123,212,389
Item B 2 133,233,333

Please HELP

This layout really isn't suited to a DataGrid - you should consider using
the <asp:Repeater> control instead...
 
is this a winforms application or a web application? As Mark pointed out,
this layout isn't really conducive with the built in behavior of a datagrid
although there is something you can do.

The essential approach is the same with either winforms or asp.net. Create
a custom control which will be a composite control. One way is to add a
panel, then add a grid to it and then possibly another panel underneath
that. In the second panel, you can use GDI+ to print out the text, or you
can use a Label, textbox or both. Create public properties for the control
that correspond to the summaries. If this is static (i.e. there will only
be two, then you can simply hard code it, otherwise you may want to make it
indexed so you can just add one after each other). I can't tell if the
ItemName section is the aggregate of the above, if so you can use
DataTable.Compute to grab each summary value
(http://www.knowdotnet.com/articles/expressions.html) If you're using a
ASP.NET grid, than you can do essentially the same thing, in the sense that
you are creating a custom control and use an approach such as this
(http://aspnet.4guysfromrolla.com/articles/020503-1.aspx). Either way
though, I think your best bet is creating a custom control and then
depending on the exact behavior you need, just build it into the control.
If this is a one time thing, then it will be very straightforward, and if
not, it will just take a little more forethought in respect to what you
might need it for in the future.

HTH,

Bill
 
Back
Top