Select entire row details on click of button of that row inside a GridView

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Select entire row details on click of button of that row inside a GridView

 
0
  #1
Jun 9th, 2008
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,
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 59
Reputation: FaridMasood is an unknown quantity at this point 
Solved Threads: 0
FaridMasood's Avatar
FaridMasood FaridMasood is offline Offline
Junior Poster in Training

Re: Select entire row details on click of button of that row inside a GridView

 
0
  #2
Jun 10th, 2008
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.
Thanks and Best of Lusk,

Farid ud din Masood
MS.c (CS)
University of Agriculture, Faisalabad
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

Re: Select entire row details on click of button of that row inside a GridView

 
0
  #3
Jun 10th, 2008
Originally Posted by FaridMasood View Post
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?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC