How do i determine what items from a collection of checkboxs/dropdowns/radios have been selected?

I have a html form thats getting posted, and this form will contain a list of items displayed as <inputs> but under different types and in differnt qtys each time, e.g. sometime i may get 1 other times  i may get 10.

What the easist way for me to easy identify whats been selected if this is  getting posted to a .net form?
<input name="listname" type="checkbox" id="listname" value="120" />

Open in new window

paulCardiffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BenMorelCommented:
Hi,
Why don't you receive directly the input values in your .net application ?
Inputs are designed for that ..!
In that cas that's a .net question, not html :)

Let me know if I misunderstood.

Regards,
Ben
0
paulCardiffAuthor Commented:
Its both i guess i.e. HTML on one side and .net on the other.

The Form doing the posting must be pure html i.e. no .net, but i agree its 50% of one and 50 % of another thus the reason i added this question in both categorys
0
BenMorelCommented:
Ok so if you already did your form with html, you'll need a .NET expert to give you the answer - not me unfortunately :)
Good luck.
Ben
0
safitechCommented:
If you've got a bunch of checkboxes you want to process, you'll need to give them all individual id's.  I'd imagine you have some kind of server-side code generating them?

You can then access them on postback using

for (int i=0; i<12; i++)
{
            string id = "listItem" + i.ToString();
            string result = Request.Form[id];
            // Do something with result
}

If memory serves, result will come up as "on"/"off" or something like that.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.