tags:

views:

308

answers:

2

I need to create a form where for each day in the month the user will enter in several different values (Im thinking a grid sort of thing, values along the top, day of the month along the side) using ASP.NET forms with C# backend...

So what would be the best way to generate this form? I dont want to hardcode that many controls as it would make the submition a little annoying but i also would need to be able to give it values entered in previous days and have it display them in the textboxes.

How would i go about creating this form and also how would i get the values from the textboxes in the backend?

+2  A: 

Here is an example application that creates a dynamic form and submits it back to the database. It's written in VB.Net but im sure it's easily converted to C#.

http://www.asp101.com/samples/form_dynamic_aspx.asp

Basically the way it works is adding the controls to the form dynamically then accessing the values that are posted to the server with the Request.Form collection.

John Boker
A: 

If you're building from scratch and can use the ASP.NET MVC framework, might be worth checking out the Dynamic Forms project over at codeplex: http://mvcdynamicforms.codeplex.com/

It might be overkill for your situation, but this appears a pretty powerful way to have a dynamic forms approach (you can store the config in an XML file, in a database etc), and posting the data back is handled by evaluating the Request object in server side code.

Harv