User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,440 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,838 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1248 | Replies: 2
Reply
Join Date: Sep 2006
Posts: 104
Reputation: bhavna_816 is an unknown quantity at this point 
Rep Power: 3
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

  #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,
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Posts: 50
Reputation: FaridMasood is an unknown quantity at this point 
Rep Power: 0
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

  #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  
Join Date: Sep 2006
Posts: 104
Reputation: bhavna_816 is an unknown quantity at this point 
Rep Power: 3
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

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 2:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC