I have a gridview connected to a database and I added a checkbox next to each row. This is my code so far.

<asp:TemplateField HeaderText="Assign" ShowHeader="True"> 
<asp:CheckBox ID="assignCheck" runat="server" CausesValidation="false" CommandName="Assign"/> 

Each row in my table holds a different user. My project is to assign a user to one of four supervisors. So what I want to do is have a drop down menu in which the user selects the supervisor. Then they go down the page checking the boxes next to the user. When they are done, they click a button, and the table now displays the supervisors name next to all the users that were selected through the check box.

How would I go about doing this? How do you get the index of the check box that is selected so that you can work with that number? I use c# by the way in visual web developer.

To add a check-all functionality in the GridView, simply add a asp:checkbox to the header template of the checkbox column.


gridview is tools its provides a facilities for show data and insert update and delete data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.