I am displaying a GridView on some specific criteria which is entered by some textboxes say studentid, studentname as input from textbox and show records in GridView.
For this I m using a stored procedure which returns a datatable based on inputs came from textboxes.
I want an Edit button in the Gridview on click of which a <div> with some label and textbox controls get displayed with prefilled entries.
For this I want the datarow from the datatable got from the stored procedure, from where I will get the complete info. Also I want to edit the data.
How can I get the row details of specified Edit button row and which way is better put a command button control in ItemTemplate of GridView or use a Buttonfield cotnrol inside the GridView?

I am working in ASP.NET2.0 and C#.

I m not getting the correct way, can anybody suggest me?

Thanks in advance,

you can show a "select" button and then
in the "selectedindexchanged" of the gridview show the selected row in the controls i.e text boxes and labels such
as

textbox1.text = gridview1.selectedrow.cell(0).text

remember that indexes of grid are zero based. Obviously you will have a save button on your page or form and edit the selected text as required and then click that button and do the database operation as required.

Hope this will help you. if you need a detail presentation i can send you a sample page.

you can show a "select" button and then
in the "selectedindexchanged" of the gridview show the selected row in the controls i.e text boxes and labels such
as

textbox1.text = gridview1.selectedrow.cell(0).text

remember that indexes of grid are zero based. Obviously you will have a save button on your page or form and edit the selected text as required and then click that button and do the database operation as required.

Hope this will help you. if you need a detail presentation i can send you a sample page.

I am a bit confused what should I use a buttonfield inside GridView or an ItemTemplate with a command button?

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.