hmmmm

G

Guest

hey all,

i have a webform with a radiobuttonlist1 on it with 2 items in it and is set
to autopostback. i have a button on the form also that when clicked, sets the
radiobuttonlist1.selectedvalue=-1.

So when i click on the radiobutton item that was selected before it was set
to -1 the postback does not occur, however if i select the other radiobutton
item it does do a postback. is this how it's supposed to work?

thanks,
rodchar
 
M

Mr Newbie

Cant reproduce it, see code below. It allways works ok for me. R u using
2002,2003 or 2005 ?

Private Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Label1.Text = Me.RadioButtonList1.SelectedItem.ToString
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.RadioButtonList1.SelectedIndex = -1
End Sub
 
K

Kevin Spencer

What is the AutoPostBack property of each radio button set to?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
G

Guest

my autopostback for the radiobuttonlist1 is set to true. ok, here's more
info: it does do the page_load event but it does not do the
selectedindexchanged event for one radiobutton item but it does for the other.
 
G

Guest

2003

Mr Newbie said:
Cant reproduce it, see code below. It allways works ok for me. R u using
2002,2003 or 2005 ?

Private Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RadioButtonList1.SelectedIndexChanged
Label1.Text = Me.RadioButtonList1.SelectedItem.ToString
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.RadioButtonList1.SelectedIndex = -1
End Sub
 
K

Kevin Spencer

Do both radio buttons have the same name? If they do not, they are not in
the same group.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
G

Guest

i'm using the radiobuttonlist control. i'm adding to the item collections
property list manually.
 
G

Guest

hey all,
here's my exact walkthrough:

1. i create a new web application in vs.net 2003
2. i drag a radiobuttonlist control onto the form
3. i goto to the properties window for the radiobuttonlist and click on
(Collection) for the Items property.
4. i add 2 items and make the first item selected by default.
5. i changed the AutoPostBack to True for the radiobuttonlist
6. i add a button and in the code behind for the button i add
radiobuttonlist1.selectedindex=-1
7. i create a stub for radiobuttonlist1_SelectedIndexChanged and add a break
point to End Sub.
8. i also put a break on the end sub for Page_Load.
9. i hit the start button.
10. i press the button on the web form and it clears the selection for
radiobuttonlist.
11. *** i select the same radiobutton item that was selected before i
cleared the list with the button and the page_load event runs but the
radiobuttonlist1_SelectedIndexChanged does not run.
11a. if i clicked any other radiobutton item than the one that was selected
the radiobuttonlist1_SelectedIndexChanged does run. Any ideas?

rodchar.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top