This is in ASP.NET with C#. I am trying to programmatically call a Javascript function from a radiobuttonlist click event. I have created the radiobuttonlist and added a couple of list items inside. I have looked around a lot but have been unable to figure this out.
C# code:
RadioButtonList _rbList = new RadioButtonList();
_rbList.ID = r[0].ToString()+"Answer";
_rbList.RepeatDirection = RepeatDirection.Horizontal;
_rbList.Attributes.Add("onchange", "return answered();");
Javascript inside my .aspx:
<script type ="text/javascript">
function answered() {
alert("I am an alert box!");
}
</script>