Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i am doing a school software project. using datagridview i will bind the
data from sqlserver.datagridview will look like this.

maths science tamil english
Lkg

Ukg

I

and now i want to add checkbox for every column below the subject column.
i don't know how to add checkbox dynamically .while displaying the data in datagridview.for ex i want to display the datagridview in this format


maths science tamil english
Lkg checkbox checkbox checkbox checkbox

Ukg checkbox checkbox checkbox checkbox

I


if anyone knows how to add checkbox dynamically .help me

Thank's in advance
Posted
Comments
Oshtri Deka 27-Mar-12 6:22am    
Whats' Lkg and Ukg and I?
What's the datatable's schema?

1 solution

If I understood your question I suggest following solution:

Make a DataTable in which you will store your data, for example:

SubjectsTable
-----------
ID IDtype
subject1 bool
subject2 bool
...
subjectN bool
someOther columns as necessary

Fill it with data (subjects and whatever you need) from DB and then use it as DataSource for your dataGridView.
C#
yourdDataGriView.DataSource = yourTable;
//columns formatting goes here etc.

//you are now ready to go! :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900