RadioButtonList event

elic05

Member
Joined
Nov 2, 2008
Messages
19
Programming Experience
Beginner
I have on indexChanged event for a RadioButtonList

VB.NET:
    Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged
        MultiView1.ActiveViewIndex = RadioButtonList1.SelectedValue
    End Sub

I want that when the page first loaded it will generate the event

I tried

VB.NET:
If Not IsPostBack Then
            Dim li As ListItem = RadioButtonList1.Items(2)
            li.Selected = True
End If

and also

VB.NET:
RadioButtonList1.SelectedValue = 2
It's only selects but it is not generate the event?

maybe I have to cal the sub RadioButtonList1_SelectedIndexChanged
but with whitch arrguments?

How can this be done?
thanks
 
Dropped a RadioButtonList and TextBox on my page for testing. Below you'll find the code behind.

VB.NET:
Partial Class _Default
    Inherits System.Web.UI.Page

	Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
	Handles RadioButtonList1.SelectedIndexChanged

		Me.TextBox1.Text = Me.RadioButtonList1.SelectedValue

	End Sub
End Class

Set AutoPostBack to True and you should get the results you're looking for.
 
Back
Top