Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.73/5 (4 votes)
hello friends i m having gridview items are name,firstname,lastname

by using datatable i showed the details in gridview.

i used name item template as linkbutton

when i click any name in gridview... the row details will shown in textboxes... by that i want to update edit and delete the record.without using default edit,update and delete event in gridview give me some solution please
Posted
Updated 10-Jul-17 5:39am
v5
Comments
version_2.0 18-May-11 8:03am    
not clear

// @nk_Getting cell value into TextBox
private void dataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
textBox1.Text = row.Cells["Itemname"].Value.ToString();
textBox2.Text = row.Cells["Qty"].Value.ToString();
textBox3.Text = row.Cells["Tax"].Value.ToString();
}
}
 
Share this answer
 
v2
Comments
Richard Deeming 10-Jul-17 12:33pm    
SIX YEARS too late!
CHill60 10-Jul-17 13:52pm    
I suggest you remove your email from your solution. This is an open forum and Spammers like emails
get the gridview selected index and using that index display textboxes like

textbox1.text=gridview1.rows[index].cells[0].tostring();
....
....


and then inserting,updating and deleting are very easy part.
 
Share this answer
 
Comments
Gadosky 9-Jun-13 9:02am    
after selected row in textbox how to update from button control ????
Take a look at this-[How to get the Values of Selected Row from a Gridview in TextBox using ASP.NET][^] article which will guide you how to do it with snaps as well as code.
Try it!
 
Share this answer
 
Comments
beginner in C#.net 18-May-11 8:24am    
in that tutorial we can select using default select button. i want to get data when i click any data in gridview
Mollly Qi 14-Nov-12 21:34pm    
the link is broken, I can't see anything!

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