开发者

Which ASP.NET server controls to use?

Trying to learn ASP.NET (with several years of classic ASP development under the belt), and struggling with the myriad server controls for rendering data.

I'm trying to pivot data using server-side data objects. A good example is a table of Customers with three columns: 1) customer id, 2) customer name 3) nested list of Order ids. There is, of course, a one-to-many relationship between Customers and Orders. In classic ASP, I would have used two arrays--one for Customers and one for Orders--and I would have iterated through the Orders array once for each iteration of the Customers array, pulling out the appropriate Order records as needed.

Instead, I'm trying to take advantage of the .NET framework controls, so I'm thinking that I'll dump the Orders into a DataTable, and then I'll create a GridView for the Customers data, with a custom TemplateFiel开发者_高级运维d that calls to a sub that loops through the Orders DataTable and binds the right records to some sort of object (ListView? Literal?) that then gets bound to the appropriate row in the Customers GridView.

Is this right? Am I picking the right controls to use for this purpose? I'm tempted to just use VB arrays and do it the way I've always done it (mashing together a string of HTML with repeated concatenations), but I'm trying to make an effort to harness the efficiency of the framework.

Thanks for any guidance.


It sounds like you are on the right track. Some sort of Master/Details setup should do the trick for you and should be very very easy to link together.

http://www.asp.net/data-access/tutorials/master-detail-using-a-selectable-master-gridview-with-a-details-detailview-cs

This seems like a great start to me, and I defiantly think that the investment with the new controls will pay off in the long run.


Pluralsight.com have a great course for ASP.NET Web Forms which should get you on a solid grounding using the ASP.NET framework.

Building Applications with ASP.NET 4 WebForms

In particular, I would check out Working With DataSource Controls, which is more relevant to what you are trying to achieve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜