How to structure a XML-based order form using ASP.NET

Posted by Brendan on Programmers See other posts from Programmers or by Brendan
Published on 2012-11-12T19:20:27Z Indexed on 2012/11/12 23:13 UTC
Read the original article Hit count: 544

Filed under:
|
|

First question here; please help me if I'm doing something wrong.

I'm a graphic designer who's trying to teach himself ASP.NET/C#. My server-side background is PHP/WordPress and some ASP Classic, and when I do code I've hand-coded just about everything since I started learning HTML. So, as I've started to learn .NET, my code has been very manual and procedural.

I'm now trying to create a really basic order form that pulls from an XML file to populate the form; there's an image, a title, a price, and selectable quantities. If I was making this form as a static HTML file, I'd have each field named manually and so on postback I could query each field to get the values. But I'm trying to do this dynamically so that I can add/remove items from the form and not have to change the code.

In terms of displaying the XML, I rolled my own by loading XmlDocument and using XmlNodeList and a bunch of foreach loops to get things displayed. Then, I learned about <asp:XmlDataSource> and <asp:Repeater>, which made displaying the XML simpler by a large margin. However, I've had a really hard time getting the data that's been submitted on postback (it was implied on SO that there are better ways to get data than nested RepeaterItems).

So, what I've learned so far is that you can do things a bunch of different ways in .NET. that's why I thought it'd be good to ask for answers regarding the best way to use ASP.NET to display a XML document and dynamically capture the data that's submitted.

Any help is appreciated! I'm using Notepad++ to code .NET 2.0.

© Programmers or respective owner

Related posts about design

Related posts about ASP.NET