Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
Select radio button client-side
posted

In my .aspx page I have an Itemtemplate code to display a RadioButtonList:

<ig:TemplateDataField Key="TemplateField_Status">
   <Header Text="Status">
   </Header>
   <ItemTemplate>
      <asp:RadioButtonList ID="rblStatus" runat="server" RepeatDirection="Horizontal">
         <asp:ListItem Selected="True" style="padding-right:25px;">Exclude Time</asp:ListItem>
         <asp:ListItem style="padding-right:25px;">Stop</asp:ListItem>
         <asp:ListItem>Complete</asp:ListItem>
      </asp:RadioButtonList>
   </ItemTemplate>
</ig:TemplateDataField>

I have a button on the web page that calls JavaScript code and I'd like to change all the rows in the grid to have the "Complete" ListItem selected.  How do I reference the radio button so I can set the "Complete" radio button for each row?

Parents
No Data
Reply
  • 275
    Offline posted

    I didn't figure out how to do this client-side, but I am able to set the radio buttons server-side.

    Using the following code I was able to set the radio button in code-behind using C#:

    WebDataGrid grid = WeldsDataGrid;
    RadioButtonList rbl_response;

    foreach (GridRecord row in grid.Rows)
    {
       rbl_response = (RadioButtonList)row.Items[4].FindControl("rblStatus");
       rbl_response.SelectedValue = "Complete";
    }

Children