views:

56

answers:

1

Hi there, I've got a form with textboxes and I want to run some server side validation code on the values after the form is submitted. I was planning to grab all the textbox controls on the page and adding them to a list, then running a for each loop that says for each control in the list query the database where fieldValidation.Name = Control.Name. This would return to me an object and an associated function where i coudl then input the Control.Value and actually perform the validation.

My friend told me building the list is not necessary because all languages have a way to get key/value pairs from forms (he doesn't know .NET so coudln't help me). I may be searching the wrong term here but I have not been able to find a result, or maybe I misunderstood my friend.

Is there some kind of dictionary or key/value pair automatically generated upon form submissions that contains the value that was submitted and...I guess also the control? Or am I just misunderstanding him. If he was just saying populate a key/value pair based on the form submissions, how does that help me in this situation over a list that contains the control?

Thanks =)

+1  A: 

HttpContext.Current.Request.Form : http://msdn.microsoft.com/en-us/library/system.web.httprequest.form(v=VS.71).aspx

Tim Mahy
Yes! I see now, I kept searching for key/value pairs from form or something similar. I didn't think of using the word collection ><. Thanks!
AverageJoe719