J
Jon
I would like to pass a reference of a webcontrol into a javascript
function. Below I have a snippet of code. "me.selectedValue" returns
undefined. I was hoping that would return the value that the user has
selected in the radio list..
ps: this is my first post, be gentle
**aspx page**
<form id="Form1" method="post" runat="server">
<asp:RadioButtonList ID=radio1 Runat=server >
<asp:ListItem Value=1 >Option 1</asp:ListItem>
<asp:ListItem Value=2 >Option 2</asp:ListItem>
<asp:ListItem Value=3 >Option 3</asp:ListItem>
</asp:RadioButtonList>
</form>
**Code Behind**
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strScript As String = "<script language=""JavaScript"">" &
vbCrLf
strScript += " function test1(me) " & vbCrLf
strScript += "{alert(me.SelectedValue); " & vbCrLf
strScript += "}</script>"
If (Not Page.IsClientScriptBlockRegistered("clientScript"))
Then
Page.RegisterClientScriptBlock("clientScript", strScript)
End If
End Sub
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender
radio1.Attributes.Add("onclick", "test1(this)")
End Sub
function. Below I have a snippet of code. "me.selectedValue" returns
undefined. I was hoping that would return the value that the user has
selected in the radio list..
ps: this is my first post, be gentle
**aspx page**
<form id="Form1" method="post" runat="server">
<asp:RadioButtonList ID=radio1 Runat=server >
<asp:ListItem Value=1 >Option 1</asp:ListItem>
<asp:ListItem Value=2 >Option 2</asp:ListItem>
<asp:ListItem Value=3 >Option 3</asp:ListItem>
</asp:RadioButtonList>
</form>
**Code Behind**
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strScript As String = "<script language=""JavaScript"">" &
vbCrLf
strScript += " function test1(me) " & vbCrLf
strScript += "{alert(me.SelectedValue); " & vbCrLf
strScript += "}</script>"
If (Not Page.IsClientScriptBlockRegistered("clientScript"))
Then
Page.RegisterClientScriptBlock("clientScript", strScript)
End If
End Sub
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender
radio1.Attributes.Add("onclick", "test1(this)")
End Sub