views:

53

answers:

2
<asp:RadioButtonList ID="rbEmployeeGroup" runat="server" RepeatDirection="Horizontal"
    AutoPostBack="true" OnSelectedIndexChanged=" [Call java script to check first] then rbEmployeeGroup_SelectedIndexChanged">
    <asp:ListItem Selected="True" Text="Employees" Value="employees"></asp:ListItem>
    <asp:ListItem Text="Groups" Value="groups"></asp:ListItem>
</asp:RadioButtonList>

How to call the javascript function before call rbEmployeeGroup_SelectedIndexChanged this code behind function?

+2  A: 

You need to add an onclick handler to every radiobutton in your list.

This can be done in your server code before the control is rendered.

foreach (var item in rbEmployeeGroup.Items)
{
   item.Attributes.Add("onclick", "nameOfJavascriptFunction");
}
womp
A: 

I figured out. Just add the onClientClick = "..."

sza