Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
i want to retrieve the values inside the row in gridview.
but i enable the autogenerated edit button and autogenerated column because i am selecting the database and table in the dropdownlist and then i open the table through the gridview.For editing i will clicks the edit button it will transfer all its values to the textbox after editing, i want that all cell values please tell me how can i get ,,,,
i used this but it returns null
  int rowindex = Convert.ToInt32(e.RowIndex);
string column_name = GridView4.Rows[rowindex].Cells[2].Text;
Posted 24-Dec-12 22:29pm
Edited 24-Dec-12 22:30pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi,
 
After editing when you click on update button read all the textbox values at that time.
  Permalink  
Comments
Member 9644686 at 25-Dec-12 5:29am
   
text box means not the outside textbox .it is in the gridview itself that means that you add autogenerated edit button then click edit it will automatically create a textbox in the gridview that all values are filled in this txtbox. i don't know the id of that txtbox.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

HI,
 
You can do this by assigning the cell values into hidden fields while binding the data to the grid. And when you are trying to access the value on the edit button click you can get the values from the hidden fields easily. Try like this.
 
how to edit and update row values in grid view?
edit,update row in gridview
 

Thanks
  Permalink  
v2
Comments
Member 9644686 at 25-Dec-12 6:15am
   
boss i want to do update on database....
i can't please if u have any snippets please i will refer and i will try to do that.

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

  Print Answers RSS
0 OriginalGriff 270
1 Sergey Alexandrovich Kryukov 144
2 Rob Philpott 100
3 CHill60 70
4 Peter Leow 60
0 OriginalGriff 6,902
1 Sergey Alexandrovich Kryukov 5,623
2 Maciej Los 3,479
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2014
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