473,414 Members | 1,628 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Request.Form.GetValues();

I am dynamically creating htmlinputcheckbox controls. Each of these will have
a name,id and value.

The user make a selection by checking the checkboxes. I then want to
retrieve the the checkboxes selected.

Where i am having difficulties is that these htmlinputcheckboxes are not
part of a control collection, so i am baffled as to how i can retrieve them
using
Request.Form.GetValues();

How can I get retrieve which checkboxes have been checked by the user?

thank you.

Nov 17 '05 #1
5 13079
Hi,

Doesn't ASP .NET allow creating server-side checkbox controls? If you create
those dynamically, they must become a part of the control collection, given
you re-create them in the same quantity and order on postback.

P.S. I haven't had experience with ASP .NET for more than a year for now, so
I apologize beforehand if I am giving some incorrect information. I remember
it worked for me in a similar to the described way, but I can be obviously
missing certain details.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"CodeRazor" <Co*******@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I am dynamically creating htmlinputcheckbox controls. Each of these will
have
a name,id and value.

The user make a selection by checking the checkboxes. I then want to
retrieve the the checkboxes selected.

Where i am having difficulties is that these htmlinputcheckboxes are not
part of a control collection, so i am baffled as to how i can retrieve
them
using
Request.Form.GetValues();

How can I get retrieve which checkboxes have been checked by the user?

thank you.


Nov 17 '05 #2
thank you.
Can you tell me when you would explicitly require using htmlcontrols rather
than a web server control and maybe describe an example.

thx

"Dmytro Lapshyn [MVP]" wrote:
Hi,

Doesn't ASP .NET allow creating server-side checkbox controls? If you create
those dynamically, they must become a part of the control collection, given
you re-create them in the same quantity and order on postback.

P.S. I haven't had experience with ASP .NET for more than a year for now, so
I apologize beforehand if I am giving some incorrect information. I remember
it worked for me in a similar to the described way, but I can be obviously
missing certain details.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"CodeRazor" <Co*******@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I am dynamically creating htmlinputcheckbox controls. Each of these will
have
a name,id and value.

The user make a selection by checking the checkboxes. I then want to
retrieve the the checkboxes selected.

Where i am having difficulties is that these htmlinputcheckboxes are not
part of a control collection, so i am baffled as to how i can retrieve
them
using
Request.Form.GetValues();

How can I get retrieve which checkboxes have been checked by the user?

thank you.


Nov 17 '05 #3
CodeRazor,

When you are creating your controls dynamically, you are using some
prefix and an identifier, like "checkbox1", "checkbox2", "checkboxN".

All you have to do is check for the existence for the value upon return,
incrementing the index (1, 2, N) until the values returned from the form
indicate that there are no more checkboxes to check.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"CodeRazor" <Co*******@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I am dynamically creating htmlinputcheckbox controls. Each of these will
have
a name,id and value.

The user make a selection by checking the checkboxes. I then want to
retrieve the the checkboxes selected.

Where i am having difficulties is that these htmlinputcheckboxes are not
part of a control collection, so i am baffled as to how i can retrieve
them
using
Request.Form.GetValues();

How can I get retrieve which checkboxes have been checked by the user?

thank you.

Nov 17 '05 #4
Hi,
Can you tell me when you would explicitly require using htmlcontrols
rather
than a web server control and maybe describe an example.
I think you can use HTML controls whenever you do not have to handle them on
server in any way (say, it's a JavaScript-based survey which collects and
pre-processes the user input on the client and then submits a form with a
hidden field to the server).

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"CodeRazor" <Co*******@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com... thank you.
Can you tell me when you would explicitly require using htmlcontrols
rather
than a web server control and maybe describe an example.

thx

"Dmytro Lapshyn [MVP]" wrote:
Hi,

Doesn't ASP .NET allow creating server-side checkbox controls? If you
create
those dynamically, they must become a part of the control collection,
given
you re-create them in the same quantity and order on postback.

P.S. I haven't had experience with ASP .NET for more than a year for now,
so
I apologize beforehand if I am giving some incorrect information. I
remember
it worked for me in a similar to the described way, but I can be
obviously
missing certain details.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"CodeRazor" <Co*******@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
>I am dynamically creating htmlinputcheckbox controls. Each of these will
>have
> a name,id and value.
>
> The user make a selection by checking the checkboxes. I then want to
> retrieve the the checkboxes selected.
>
> Where i am having difficulties is that these htmlinputcheckboxes are
> not
> part of a control collection, so i am baffled as to how i can retrieve
> them
> using
> Request.Form.GetValues();
>
> How can I get retrieve which checkboxes have been checked by the user?
>
> thank you.
>



Nov 17 '05 #5
Thanks dymtro and nicholas,

your comments were helpful to me.

CR

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: smith | last post by:
It's a time saver to "bind" .Net enums to list and comboboxes and all the samples out there seem to use GetNames and GetValues pretty interchangeably. So I was wondering what the logic is to the...
6
by: Gabriël | last post by:
Hi Folks, I've tried to do the following: public enum AssetType { Requested, InOrder, Received, InPlace, Gone }; (...) dropAssetType.DataSource = Enum.GetValues(AssetType); (...) For some...
3
by: Matthew Thompson | last post by:
I am developing an application which allows users to choose multiple text sections from a list, displayed as a CheckBoxList, for printing. The sections are being passed to a page using the...
2
by: Roshawn Dawson | last post by:
Hi, I seem to be having trouble using the Request.Form property. Before explaining what I'm trying to do, have a look at my html: <form id="Cart" method="post" action="ShoppingCart.aspx">...
5
by: whoopding | last post by:
How can I return all the properties in the Request.Browser object using a for each...next loop?
3
by: Jason Hawthorne | last post by:
I am trying to get this code to work in a class file that I use in all of my pages. Public Shared Function Check_Site() As String Dim arr() As String Dim coll As NameValueCollection coll...
4
by: Scott Durrett | last post by:
I have 2 pages. Page1 is a .html page with a form, hidden input, and a submit button. I have the action set to Post. <form id="form1" action="paymentcatch.aspx" method="post"> <input...
1
by: Jeff Mason | last post by:
I am observing some puzzling behavior with the GetValues method of enumerations. I wonder if this something I just don't understand, or is this just wrong. The documentation for the GetValues...
0
by: tualbuquerque | last post by:
Hi, I am using XP PRo, .NET 2003 and IIS. I am getting a 401 and I 100% my authentication should be fine. Any thoughts? code======================== using System; using System.Drawing;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.