DataGrid: Add Checkbox

  • Thread starter Thread starter Frank Esser
  • Start date Start date
F

Frank Esser

Hallo,

within a DataGrid with just one column I want to display a checkbox
additionally to each item text.
I can do it in the event "DataGrid_ItemDataBound" for each cell:

CheckBox myCB = new CheckBox();
e.Item.Cells[0].Controls.Add(myCB);

On the Web-Page the checkbox is displayed at the end of each text.

Is there an easy way to put the checkbox in front of the text (at the
beginning of the string)?

I do not want to create a new column, just use the existing one...

Thanks for your reply!
Best regards
Frank
 
Add the checkbox in the item template of the DataGrid in the .aspx file
instead in the codebehind.

Regards,
Kostadin Kostov
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top