how to add checkbox column to gridview

前端 未结 2 1370
轮回少年
轮回少年 2021-01-24 22:44

How to add checkbox column to gridview .

i\'ve tried:

foreach (GridViewRow objRow in GridView1.Rows)
{
   TableCell tcCheckCell = new TableCell();
   Che         


        
2条回答
  •  花落未央
    2021-01-24 23:16

    The problem is that you cannot add a CheckBox field to a GridView in order to have a column of checkboxes - the GridView doesn't support it:

    Instead you have to change the template of each row, manually adding a CheckBox control to the template of a row.

    • i can't tell you how to do that
    • i can't tell you how to read which items the user has checked
    • i can't tell you how to default some of them to checked

    But it's what you have to do.

提交回复
热议问题