Events from controls in a DataGridTemplateColumn

Posted by: bdwest on 7 August 2017, 3:42 pm EST

  • Posted 7 August 2017, 3:42 pm EST

    I have a group of 5 radio buttons in each cell of a column within a datagrid as shown below. When a button is checked it toggles one of five boolean values in my class to true. That part works fine. I also need to generate a event when any of the 5 radio buttons is changed. Since the radio buttons are embeded in the DataTemplate I can seem to access any of the radio button events. Can someone tell me how to do this, assuming it is possible.

    Thanks

    Brian



























  • Posted 7 August 2017, 3:42 pm EST

    Thanks, I had not thought about that option.

  • Posted 7 August 2017, 3:42 pm EST

    Hi Brian,

    I believe the simplest way to do that is to put the content of the cell(The radio buttons) into a usercontrol, then each cell will have this user control as the template of the cell. As you can see you can put the logic of the radio buttons in the user control code behind.

    Regards,

    Alvaro.

  • Posted 10 June 2019, 8:19 am EST

    I am having problems with DataGrid celltemplate and headertemplate. I have created many datagridtemplatecolumns in the code behind and when I apply both templates my data is not showing up properly.

    Is there any sample for this.

    A dataGrid build in c# with a user control in the CellTemplate and a user control in the HeaderTemplate.

    When I apply only CellTemplate my data is fine but when I apply both templates my data is no good.

    plz help

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels