Click here to Skip to main content
13,197,548 members (51,329 online)
Rate this:
 
Please Sign up or sign in to vote.
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 18-May-11 1:36am
Updated 10-Jul-17 5:39am
v5
Comments
rahulrcn 18-May-11 8:03am
   
not clear
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
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!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Member 10056579 9-Jun-13 9:02am
   
after selected row in textbox how to update from button control ????
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

// @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();
}
}
  Permalink  
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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171020.1 | Last Updated 10 Jul 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100