This is a migrated thread and some comments may be shown as answers.

RadioButtonList in RadGrid ItemCommand

3 Answers 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 21 Jan 2019, 05:15 PM

Can a radiobuttonlist trigger a call to ItemCommand inside a RadGrid.  Below, the button works, but the radiobuttonlist does not hit the event in code behind.

<telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Approvals" UniqueName="Approvals">
    ItemStyle HorizontalAlign="Left" Width="140" />
    <HeaderStyle HorizontalAlign="Left" Width="140" />
    <HeaderTemplate>
    </HeaderTemplate>
    <ItemTemplate>
        <asp:RadioButtonList ID="rdoApprovals" runat="server" RepeatDirection="Horizontal"
                    CommandName="ApproveDeny">
                    <asp:ListItem Value="1">Approve</asp:ListItem>
                    <asp:ListItem Value="2">Deny</asp:ListItem>
            </asp:RadioButtonList>
        <asp:Button ID="btnTest" runat="server" Text="test" CommandName="test" />
    </ItemTemplate>
</telerik:GridTemplateColumn>

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 24 Jan 2019, 07:53 AM
Hello Steven,

You can achieve this requirement using the own event handler of the RadioButtonList:
<asp:RadioButtonList ... AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">

Alternatively, you can use a client-side event handler (onchange for instance) and fire a grid built-in or custom command using the fireCommand method:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridtableview-object/methods/firecommand

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Steven
Top achievements
Rank 1
answered on 25 Jan 2019, 12:48 AM
Thank you Eyup. The only downside to the controls OnSelectedIndexChanged is that we don't have easy access to grid data/embedded controls.  I just switched to buttons, no biggie.
0
Eyup
Telerik team
answered on 29 Jan 2019, 01:46 PM
Hello Steven,

I'm glad you've managed to find a solution for your specific case. Generally, you can access the container grid item inside the OnSelectedIndexChanged event handler of the combo using the following approach: (sender as RadComboBox).NamingContainer.

You can check additional samples here for general knowledge:
https://www.telerik.com/forums/how-to-have-dropdownlist-and-textbox-inside-a-radgrid#A9aPQyI5vE-ENWi8clmy6Q

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Steven
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Steven
Top achievements
Rank 1
Share this question
or