• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

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

0
paulCardiff
Asked:
paulCardiff
  • 2
1 Solution
 
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now