How to get row selected in Gridview and then to get the data from the cells in that Grid?

I have a gridview with about 30 rows of data. If someone selects a row in the grid(Clicking or double clicking) then I want to get the values in each column/cell in that row. Once I get those values, I want to populate other edit controls on my web form with the values selected from the row.

So the big question here, is how to capture the row selected from clicking or double clicking. Then how to get the column cell items?


9/25/2007 6:28:56 PM 72751 articles. 3 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 50

9/26/2007 11:48:53 AM

This tells how to make the Grid clickable, but not how to retrieve data from the cells. How do I do that?

9/26/2007 9:00:02 PM

You can use this to extract value from cell 

 lblData.Text = oGridView.Rows[0].Cells[0].Text;

Hosam Kamel

Remember to click on Mark as answer on the post that helped you
9/29/2007 11:18:30 AM

You can get the Gridview1.selectindex

Best Regards

Blog : Http://
E-Mail :
IM(Live Messager) :

9/29/2007 2:54:31 PM

Similar Artilces:

Getting data from a selected row in a gridview
I have created a webpage that has a gridview on it.  It has the following format; TagName       Value SCB_SV1      2.345SCB_SV2      3.345 What I would like to do is place Lables/Textboxs on a form that has a background image of two pumps.  It would look something like this;   SCADA WEBPAGE    lable1{2.345}         Pump#1{graphic}                   ...

Get data from selected row of gridview
Hi all,I wonder whether I can get the selected data in gridview without using index? Like GridView1.Rows(0).Cells("Name").Text   instead of Cells(0).Text.Because who will know which column is at which index right?  I have total 6 columns in my gridview. (one of them is "Select" column from gridview features and one of them is "ID" which is in hidden state)So, when I try to retrieve the selected row's ID, I got nothing. it returns nothing for this "ID" column. I use .Cells(int index).Text to get the value. (I try index 0-6, still no ID val...

How to get data field from the selected GridView row?
We can make Master-Details relationship through a gridview and a detailsview. How can we make this relation without using a detailsview or formview? so when the user selects a row in the gridview, the details data is programmitcally filled into some text controls. You don't have to use a FormView or DetailsView, but your job will be much harder. When you select a row in your GridView, within the SelectedIndexChanged handler, you can retrieve the key for the selected field. Once you have this key, you can do a simple ADO lookup using this key and extract all of the detail information f...

I cannot get the selected row cell value in my gridview.
I seem to be stumped trying to get the text value of one of my columns in my gridview.  I can get this to work if i set the row as a data key, but when i set a row as a datakey i am unable to update it from my update command.  when i try this i just get a null value string TestCase = gdvTestCaseList.SelectedRow.Cells[2].Text; does anyone have any idea why the above code doesn't work or why i can't update a datakey column?  Thanks for any help.  i converted the column to a template field so i could replace the label with a multiline text box, not sure if that ha...

How to get all values from data grid without selecting the row?
  I have a page that contains a datagrid (all input/editable fields), I want to be able to get the value for each row then add it to a dataset to save it into the database. How can I do that? this is how i add the columns dtg = new DataTable(); dc = new DataColumn("Invoice Date", System.Type.GetType("System.String")); dtg.Columns.Add(dc); dc = new DataColumn("Target Billing Amount", System.Type.GetType("System.String")); dtg.Columns.Add(dc); dc = new DataColumn("Amount Co...

How to get the Gridview Selected row cell value in Javascript?
Sir,          I having Five Rows in the Grid.In the GridView Template I using Button in Column[6].If I edit Third Row after I Click button (Column[6] ).I want to take the Column[9] value in the Grid from Selected Third Row in Client Side.                       Please Reply Soon....   Regards, Ganeshpa.S In the RowDataBound event of the GridView, add an "onclick" attribute to the Button to a function that acc...

Getting data from selected gridview to another gridview
hello, can anyone help me with this problem? this is the situation: i have a gridview(gridview1) connected to a sqldatasource of unverifiedrecord table, and it has a select button. what i'm trying to do is whenever I select an item in gridview1, another gridview (gridview2) will show up showing all posible matches of selected item in gridview1. . gridview2 is connected with sqldatasource but in different table, theorginalrecord, The two tables contains same columns execpt for their ID(gridview1 has AlumniID and 2nd has SubmittedID) thank you in advance... I know below l...

How to get two gridviews in one cell of a row in .net 2.0
Hi I am trying to display two gridviews in a row using datalist.  This is how my code looks <asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" DataKeyField= "GroupID" RepeatColumns="2" OnItemDataBound="DataList1_ItemDataBound">                              <ItemTemplate>              &nb...

How to get selected index of dropdownlistboxs present in two different rows of gridview
I have a gridview, in that i have dropdownlistbox as one column.  Without editing the grid view i want to know the selected index of dropdownlistbox for each row. See, EdMicrosoft MVP - ASP/ASP.NET...

How to get selected index of dropdownlistboxs present in two different rows of gridview
I have a gridview, in that i have dropdownlistbox as one column. Without editing the grid view i want to know the selected index of dropdownlistbox for each row. Simply itearte through the Rows collection of your GridView. Then, use the FindControl method of the GridViewRow reference and retrieve a reference to your DropDownList. From here, you can then retrieve your SelectedIndex. This can be done within the GridView.DataBound event or later.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

I can't get value of control in the selected row of a Gridview
I'm trying to perform an update using a sqldatasource from a gridview after a selection is made from a dropdown and a linkbutton "lbnUpdate" is clicked. I assigned  "select" as the command name of the linkbutton so I was assuming that I could then reference the gridviews selected row from the code behind but I guess I made a bad assumption. During debug there is "nothing" in the variable I use to capture the gridview selected row. I will post what I have. If I set AutoGenereateSelect button to true I can get the SelectedIndexChanged event...

[:'(] can't get the value of a cell from gridview selected row
Hi guys I made created a gridview that shows shopping cart items. this gridview uses storedprocedure that uses two parameter. (cartid=session.sessionid and productid=int) anyway, I would like to put row delete command and quantity update futures to it. I am using VWD and VB if any of you can send me some sample script will be greatly appriciated.   my biggest problem is that I do not know how to reach to selected row productid value thanks in advance Did you set the DataKeyNames in  your GridView? <asp:GridView ID="GridView1" DataKeyNames="int" .... (VB) ... I click the Select in my grid but previous row gets passed to my variable.
Hello all. I'm a newbie to The dropdown part works fine but I included it so you get an overall idea: Steps:  - select value from dropdown - pass value from dropdown to variable "kb" -use variable "kb" in SQL String "strSOKICKBACKS" -use "strSOKICKBACKS" to build grid "SOKickbacksGridView" -user Selects row in grid  "SOKickbacksGridView" - pass sales order from selected row in "SOKickbacksGridView" to variable "fsono" -use variable "fsono" in SQ...

Gridview Rows Backcolor getting reset when selecting a row
I have a list of rows in my gridview that list one or more entries per date.  I have coded the RowDataBound event so that all of the rows for a given date have the same backcolor.  Day 1 is white, Day 2 is yellow, Day 3 is white, day 4 is yellow - where each day could have multiple rows.  On each row, I also have an Edit imagebutton that allows each row to be edited via a separate panel and not in-line grid editing.  When I click on the Edit imagebutton, I set the gridviews selectedindex to that row and then using the skin for the grid, the selected row backco...

Web resources about - How to get row selected in Gridview and then to get the data from the cells in that Grid? -

Portal:Bollywood/Selected biography - Wikipedia, the free encyclopedia
Write three or four paragraphs in the text field using information from the selected notable article, you may find it useful to examine the existing ...

F8: Facebook’s FbStart Initiative Will Give Selected Developers A $30K Kick-Start
... successful applications is likely a whole lot easier with $30,000 in free tools and services to start off with, and that’s exactly what selected ...

LEGO Shop - The LEGO Technic team has selected the winner... - Facebook
The LEGO Technic team has selected the winner of the Co-Creation Challenge! LEGO will be producing a limited run of 20,000 of this stunning set.... ...

Grand Doctor Ma Selected Students-baby365 on the App Store on iTunes
Get Grand Doctor Ma Selected Students-baby365 on the App Store. See screenshots and ratings, and read customer reviews.

Selected Cheney Vice Presidential Photographs
... for photos found within these albums are Paul Morse, Karen Ballard, Kimberlee Hewitt, Shealah Craighead, and Chris Greenberg. These selected ...

[iOS Advice] How To Clarify Your Email Replies By Quoting Selected Text - YouTube
Follow me on Twitter: Like my Facebook page: RATE, COMMENT, SUBSCRIBE! :-) ...

UAE Under-19 cricketers for ACC Premier League tour of Malaysia selected - The National
Coach Aaqib Javed seeking fresh blood for senior team after missing out on World Twenty20

Animal of the Day: Lucius Has Been Selected as the U.K.’s ‘Happiest Cat’
He’s got one blue eye, one green eye and a heart of gold. British mobile phone company O2 recently held some “cat auditions” to find “the UK’s ...

Boyd Cordner selected for Kangaroos squad
Sydney Roosters stars Michael Jennings and Boyd Cordner have capped a grand-final win with selection in the Australian squad for the World Cup ...

Redlands LNP branch blood-letting after Matt McEachan pre-selected
There was more blood-letting in the seat of Redlands on the weekend when a motorcycle instructor was named LNP candidate for the embattled electorate ...

Resources last updated: 12/5/2015 3:02:13 PM