C1.Win.C1FlexGrid DataType = Radiobutton

Posted by: virender.chaudhary on 27 February 2020, 6:19 am EST

    • Post Options:
    • Link

    Posted 27 February 2020, 6:19 am EST

    I am using C1.Win.C1FlexGrid and would like to display radio button in place of checkbox. when I set the i get the column as checkbox .

     Column checkboxCol = _grid.Cols[COL_CHECK_BOX];			checkboxCol.DataType = typeof(bool);
    

    is there any property available to make a radio-button and it should behave like a radio button. Please help.

    Thanks,

  • Posted 27 February 2020, 7:24 am EST

    Hi Virender,

    Although it is directly not possible to show the radio button in FlexGrid Column but you can change the CheckBox glyph similar to radio button as given in code snippet below:

    c1FlexGrid1.Glyphs[C1.Win.C1FlexGrid.GlyphEnum.Checked] = Image.FromFile(@"..\..\CheckRadio.png");
    c1FlexGrid1.Glyphs[C1.Win.C1FlexGrid.GlyphEnum.Unchecked] = Image.FromFile(@"..\..\UncheckRadio.png");
    

    And handle the CellChecked event of FlexGrid to achieve the same functionality like Radio button as given in code snippet below:

    private void C1FlexGrid1_CellChecked(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
    {
      c1FlexGrid1.SetCellCheck(e.Row, e.Col, C1.Win.C1FlexGrid.CheckEnum.Checked);
      if (e.Col == 1)
       {
        for (int i = 1; i < c1FlexGrid1.Rows.Count; i++)
           {
            if(i != e.Row)
              {
               c1FlexGrid1.SetCellCheck(i, 1, C1.Win.C1FlexGrid.CheckEnum.Unchecked);
              }
           }
       }
    }
    
    

    Please look at the attached sample implementing the same.

    Regards,

    Prabhat Sharma.

    RadioButtonFlexGridDemo.zip

Need extra support?

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

Learn More

Forum Channels