473,473 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with RadioButton

RadioButton have property Checked (true or false).
If I make RadioButtons with code, without drawing by mouse than I have
problems. I write like this:

Dim rb(0 To 2) As RadioButton
Dim n As Integer

For n = 0 To 2
rb(n) = New RadioButton
rb(n).Text = "Text: " + CStr(n)
Panel1.Controls.Add(rb(n))
Next
Session("rb") = rb
Than I call this RadioButton array from session to other procedure:

Dim rb(0 To 2) As RadioButton
rb = Session("rb")
Response.Write(rb(0).Checked)
Response.Write(rb(1).Checked)
Response.Write(rb(2).Checked)
Problem is next: Every RadioButton have property Checked=False even when
user check some button. Text property is ok, but checked property is False
every time.

How to fix it?
Dec 29 '06 #1
4 1178
Igor,

You are taking the behaviour from a checkbox.

There will only be one radiobutton in a control that can have the value
true..

(If you absolutely don't want checkboxes than you can set every radiobutton
in a groupbox (so for 3 buttons you have 3 groupboxes)). I would not do it,
because a radiobutton is a radiobutton wich is on or off.

Cor
<ig**@nesalji.hrschreef in bericht news:en**********@sunce.iskon.hr...
RadioButton have property Checked (true or false).
If I make RadioButtons with code, without drawing by mouse than I have
problems. I write like this:

Dim rb(0 To 2) As RadioButton
Dim n As Integer

For n = 0 To 2
rb(n) = New RadioButton
rb(n).Text = "Text: " + CStr(n)
Panel1.Controls.Add(rb(n))
Next
Session("rb") = rb
Than I call this RadioButton array from session to other procedure:

Dim rb(0 To 2) As RadioButton
rb = Session("rb")
Response.Write(rb(0).Checked)
Response.Write(rb(1).Checked)
Response.Write(rb(2).Checked)
Problem is next: Every RadioButton have property Checked=False even when
user check some button. Text property is ok, but checked property is False
every time.

How to fix it?


Dec 29 '06 #2
(If you absolutely don't want checkboxes than you can set every
radiobutton in a groupbox (so for 3 buttons you have 3 groupboxes)). I
would not do it, because a radiobutton is a radiobutton wich is on or off.
Problem is not group property. It is not written in my code here, but it is
shorter code. I have one groupname for more checkboxes. Problem is that I
don't know how to pick checked property from radiobuttoncontrols which is
not added by mouse. Controls was addes by code in one procedure. In other
procedure I don't view this controll array. If I put this in session in
first procedure than radiobuttons are not checked because it is procedure
for drowing and user will check it on page after drowing (after program
exits from drowing procedure). How to view in other procedure which
radiobutton is checked?
Dec 29 '06 #3
Oh, no! Nobody knows this!
How to find some control which is added by code (new instance od object on
page). How to pick some property of some control which is added by user at
run time? Can I find it with FindControl method? How to use findcontrol
method? Please help!


Dec 29 '06 #4
Igor,

What your code probably does is setting the previous button of by setting
the next. There is not something as a group radiobutton. They are all
groupbuttons from the page as long as they are not set in a special group.

Cor


"Igor" <ig**@nesalji.hrschreef in bericht
news:en**********@sunce.iskon.hr...
Oh, no! Nobody knows this!
How to find some control which is added by code (new instance od object
on page). How to pick some property of some control which is added by user
at run time? Can I find it with FindControl method? How to use findcontrol
method? Please help!


Dec 29 '06 #5

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

Similar topics

8
by: VK | last post by:
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from...
3
by: sofie | last post by:
Hello all, I use the following javascript function in a html document to set the level of one of eight available radiobuttons. The line that's commented out works fine under IE, but I need to...
3
by: dave | last post by:
I have half a dozen web form radio buttons on a web form. Each of them is set to postback=true. However, if for instance radiobutton1 is already selected and the user selects it again, it performs...
4
by: Saber | last post by:
I have a web application and we had nice days, I don't know why I installed ..netframework sp1 and then a strange error happend: Control 'rdPoll_0' of type 'RadioButton' must be placed inside a...
3
by: Nathan Sokalski | last post by:
I am using the AddHandler statement to add a CheckedChanged event handler to a series of RadioButtons that I create in a loop. However, the handler is not being called for a reason I cannot...
8
by: johnmmcparland | last post by:
Hi all, my program is trying to add group boxes with radio buttons at run time. While at one point it was able to draw the group boxes without the radio buttons, now it encounters problems just...
6
by: Radiobutton via DotNetMonster.com | last post by:
i need help with radiobuttons. i am useing 1button and 2 radiobuttons i am trying to make it so when u select a radiobutton and hit button1 it will clear radiobuttons 1 and 2. -- Message...
4
by: Igor | last post by:
RadioButton have property Checked (true or false). If I make RadioButtons with code, without drawing by mouse than I have problems. I write like this: Dim rb(0 To 2) As RadioButton Dim n As...
1
by: Trev | last post by:
Hi, I'm hoping that someone in this group can shed some light on an issue I'm having with a Formview. I have a Web User Control (.ascx) with a Formview. The Formview contains 2 Multiviews,...
8
by: =?Utf-8?B?UmljaA==?= | last post by:
If you enclose a group of radiobuttons (option buttons in MS Access) in an option group control (a frame control) in Access -- the frame control will return the index of the option button that is...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.