.NET - getting form field key/value pairs?

Posted by AverageJoe719 on Stack Overflow See other posts from Stack Overflow or by AverageJoe719
Published on 2010-04-08T17:02:57Z Indexed on 2010/04/08 17:03 UTC
Read the original article Hit count: 331

Filed under:
|
|
|

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 =)

© Stack Overflow or respective owner

Related posts about .NET

Related posts about forms