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

Create GridButtonColumn dynamically

1 Answer 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nazim
Top achievements
Rank 1
Nazim asked on 07 Jan 2011, 04:47 PM
Hi,
Is there a way to add radio button to all cells of grid. Only one cell of the grid will be selected(checked) at same time. I couldn't find changing button type to radio. For normal radbutton, it  is "ButtonType="ToggleButton" ToggleType="Radio".

Think that there is a gird which has 3 columns and 3 rows.  First column's type is datetime. Other two columns' type is boolean and shown at cell as radio button.  User will be able to select only one radio of the matrix.

Regards,

view;
                   cola      colb   
date1              O        O
date2              O        O
date3              O        O


GridButtonColumn btnCol = new GridButtonColumn();
                btnCol.DataTextField = c.ToString();
                btnCol.HeaderText = dt.Columns[c].Caption;
                btnCol.HeaderStyle.Font.Bold = true;
                btnCol.ButtonType = GridButtonColumnType.LinkButton;
                rgridDeliveryDate.MasterTableView.Columns.Add(btnCol);

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Jan 2011, 07:09 AM
Hello Nazim,

The available buttons types for GridButtonColumn are: PushButton, LinkButton and ImageButton. If you want to add RadioButton dynamically, one possible option is creating a GridTemplateColumn and add one RadioButton in ItemTemplate.

And please refer the 'Creating templatecolumn programmatically' part of  following documentation for creating GridTemplateColumn dynamically.
Programmatic creation

Hope this helps,
Princy.
Tags
Grid
Asked by
Nazim
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or