Click here to Skip to main content
14,735,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends,

here i need a solution to select a rows in a gridview which is bind to database by c# sharp coding not by wizard, plzz help me out guys.
Posted
Comments
coded007 30-Nov-11 23:48pm
   
Can you please post a pseudo code for understanding your problem
[no name] 30-Nov-11 23:48pm
   
so what do you exactly need? the code for populating the gridview or the code for getting the selected row? or code for inserting a checkbox to a gridview?
Manoj K Bhoir 30-Nov-11 23:52pm
   
Please provide more information about your problem.

Try this code it creates new column for Checkbox in your DataGrid View.
DataGridViewButtonColumn chkbox = new DataGridViewButtonColumn();
chkbox.HeaderText = "Select Row";
chkbox.UseColumnTextForButtonValue = true;
dataGridView1.Columns.Add(chkbox);

After that you can code on checkbox selection to select a row of DataGridView.
   
v2
If you need to add a checkbox in your gridview, do the ff:

<asp:templatefield itemstyle-width="10px" xmlns:asp="#unknown">
                        <HeaderTemplate>
                            <asp:checkbox id="chkAllItem" runat="server" />
                        </HeaderTemplate>
                        <itemtemplate>
                            <asp:checkbox runat="server" id="chkItem" />
                        </itemtemplate>
                        <itemstyle width="10px" />
                    </asp:templatefield>


If this doesn't answer your question, please let me know.

Regards,
Eduard
   
   

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